@cedros/pay-react 1.1.31 → 1.1.32

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.
Files changed (67) hide show
  1. package/dist/{AISettingsSection-DXWDF4Cf.mjs → AISettingsSection-ChBtZVz7.mjs} +4 -4
  2. package/dist/{AISettingsSection-B12x5sV5.js → AISettingsSection-DSROL7Lg.js} +1 -1
  3. package/dist/{AutosaveIndicator-D966vOrP.mjs → AutosaveIndicator-BTa2YPNH.mjs} +1 -1
  4. package/dist/{AutosaveIndicator-CJdkhZis.js → AutosaveIndicator-BgDnlrCW.js} +1 -1
  5. package/dist/{ChatLogsSection-CH37u0nX.js → ChatLogsSection-B5AdoZls.js} +1 -1
  6. package/dist/{ChatLogsSection-DR7mpuQS.mjs → ChatLogsSection-D8FX7Dmn.mjs} +2 -2
  7. package/dist/{ComplianceSection-C61_Hf-X.mjs → ComplianceSection-A1hgI_X2.mjs} +3 -3
  8. package/dist/{ComplianceSection-DS4e2IBp.js → ComplianceSection-UWfkNrmW.js} +1 -1
  9. package/dist/{CustomersSection-CWWvusxs.mjs → CustomersSection-BuSVgS16.mjs} +2 -2
  10. package/dist/{CustomersSection-Bzs9Qon3.js → CustomersSection-Rh552kcC.js} +1 -1
  11. package/dist/{DisputesSection-ClcYIHga.js → DisputesSection-BtMdxOuD.js} +1 -1
  12. package/dist/{DisputesSection-D8rcS5Vs.mjs → DisputesSection-DqWrBCyC.mjs} +2 -2
  13. package/dist/{Dropdown-BuKiVR_L.js → Dropdown-CWYy2Rtt.js} +1 -1
  14. package/dist/{Dropdown-0y3S40Xf.mjs → Dropdown-DHCHYuTB.mjs} +1 -1
  15. package/dist/{ErrorBanner-DAjYj6Dx.mjs → ErrorBanner-7naZtdtD.mjs} +1 -1
  16. package/dist/{ErrorBanner-DxrRVqwe.js → ErrorBanner-BOS1XAPu.js} +1 -1
  17. package/dist/{FAQSection-0UnN2BZs.js → FAQSection-DczKj0C3.js} +1 -1
  18. package/dist/{FAQSection-Dck0NM-A.mjs → FAQSection-x0ya8PvI.mjs} +3 -3
  19. package/dist/{ImagesSection-Bn9GrRRa.mjs → ImagesSection-CMvHgbtL.mjs} +2 -2
  20. package/dist/{ImagesSection-CSwBHvNl.js → ImagesSection-tRpBN-ls.js} +1 -1
  21. package/dist/{InventorySection-Dytfmtn8.mjs → InventorySection-5PEOXciZ.mjs} +2 -2
  22. package/dist/{InventorySection-ymxaMcIg.js → InventorySection-clEVFr_r.js} +1 -1
  23. package/dist/{MessagingSection-Dtfv0DvU.js → MessagingSection-BpwTsNW1.js} +1 -1
  24. package/dist/{MessagingSection-CHFbSxJL.mjs → MessagingSection-Bt84iW-5.mjs} +3 -3
  25. package/dist/{OrdersSection-BuzTs9XG.js → OrdersSection-Bsou3cwl.js} +1 -1
  26. package/dist/{OrdersSection-vYNuVF5X.mjs → OrdersSection-kJzPO6CP.mjs} +2 -2
  27. package/dist/{PaymentSettingsSection-BOaW8lLv.js → PaymentSettingsSection-CUgUJ7tm.js} +1 -1
  28. package/dist/{PaymentSettingsSection-BqdGrXen.mjs → PaymentSettingsSection-s_XMFPik.mjs} +3 -3
  29. package/dist/{ReturnsSection-CRzhXKtI.mjs → ReturnsSection-BcwsQbrU.mjs} +2 -2
  30. package/dist/{ReturnsSection-i5W_3so1.js → ReturnsSection-BwHv1HkV.js} +1 -1
  31. package/dist/{SettingsSection-CIhO51Zj.js → SettingsSection-B_feZEzU.js} +1 -1
  32. package/dist/{SettingsSection-6o3d8DrH.mjs → SettingsSection-OI1G3b40.mjs} +1 -1
  33. package/dist/{ShippingSection-CbNzGyCP.mjs → ShippingSection-B2GtSEvn.mjs} +2 -2
  34. package/dist/{ShippingSection-BUzPW1AG.js → ShippingSection-DyTGH_Fh.js} +1 -1
  35. package/dist/{SingleCategorySettings-Qj_ptB_x.mjs → SingleCategorySettings-Cd76sY00.mjs} +4 -4
  36. package/dist/{SingleCategorySettings-BxVUUy8R.js → SingleCategorySettings-Ci6hJ0Xu.js} +1 -1
  37. package/dist/{StatsBar-CwCBHBn-.mjs → StatsBar-B_lf0ph0.mjs} +1 -1
  38. package/dist/{StatsBar-DDUWoizP.js → StatsBar-CVqsD8j2.js} +1 -1
  39. package/dist/{StorefrontSection-CZZj5he9.js → StorefrontSection-BxaWrsPc.js} +1 -1
  40. package/dist/{StorefrontSection-DIYDmj59.mjs → StorefrontSection-DW0q9GsC.mjs} +4 -4
  41. package/dist/{SubscriptionsSection-lMVHdV5X.mjs → SubscriptionsSection-CNHPCync.mjs} +3 -3
  42. package/dist/{SubscriptionsSection-Bof5MElz.js → SubscriptionsSection-QMoSKKot.js} +1 -1
  43. package/dist/{TaxSection-Be-9v60Z.js → TaxSection-BKhh7kOv.js} +1 -1
  44. package/dist/{TaxSection-dD7PzQvG.mjs → TaxSection-BwLpiery.mjs} +2 -2
  45. package/dist/Token22Section-B_URxab9.js +1 -0
  46. package/dist/{Token22Section-Dos0CYEk.mjs → Token22Section-DyNDKGdU.mjs} +227 -212
  47. package/dist/{WebhooksSection-CiLDyl7c.js → WebhooksSection-BIs2Qh-o.js} +1 -1
  48. package/dist/{WebhooksSection-5gqXzIhq.mjs → WebhooksSection-bDVQE9Qp.mjs} +2 -2
  49. package/dist/admin.js +1 -1
  50. package/dist/admin.mjs +1 -1
  51. package/dist/crypto-only.js +1 -1
  52. package/dist/crypto-only.mjs +1 -1
  53. package/dist/index.js +1 -1
  54. package/dist/index.mjs +1 -1
  55. package/dist/{plugin-BIkt3boU.mjs → plugin-CuoGEYWr.mjs} +23 -23
  56. package/dist/{plugin-Dw8_Q8rE.js → plugin-DNhaPAbC.js} +1 -1
  57. package/dist/{sections-D1d83mfH.js → sections-BYdyCKFF.js} +1 -1
  58. package/dist/{sections-DcUfZQNE.mjs → sections-vLd_ind5.mjs} +4 -4
  59. package/dist/src/components/admin/LiquidityPoolTab.d.ts.map +1 -1
  60. package/dist/src/components/admin/PoolManagementView.d.ts.map +1 -1
  61. package/dist/src/managers/MeteoraPoolManager.d.ts.map +1 -1
  62. package/dist/src/utils/optionalPeerImport.d.ts +6 -0
  63. package/dist/src/utils/optionalPeerImport.d.ts.map +1 -0
  64. package/package.json +1 -1
  65. package/dist/Token22Section-Di5fHsrU.js +0 -1
  66. package/dist/pay-react_false-CPX8Vyp9.mjs +0 -5
  67. package/dist/pay-react_false-DaeIe3_l.js +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),q=require("./plugin-Dw8_Q8rE.js"),D=require("./ErrorBanner-DxrRVqwe.js"),E=require("./dateHelpers-BKW_lGND.js"),U=n=>n==="success"?"success":n==="failed"?"failed":n==="pending"||n==="processing"?"pending":"muted",x=(n,d=48)=>n.length>d?`${n.slice(0,d)}…`:n;function O({serverUrl:n,apiKey:d,authManager:j}){const[a,L]=s.useState("active"),[y,p]=s.useState([]),[c,W]=s.useState(0),[h,C]=s.useState("all"),[N,f]=s.useState(!0),[_,g]=s.useState([]),[k,T]=s.useState(0),[F,v]=s.useState(!1),[w,A]=s.useState(!1),[$,l]=s.useState(null),[z,o]=s.useState(null),r=s.useCallback(async(t,i)=>{if(j?.isAuthenticated())return j.fetchWithAuth(t,i);const S={"Content-Type":"application/json"};d&&(S["X-API-Key"]=d);const u=await fetch(`${n}${t}`,{...i,headers:{...S,...i?.headers}});if(!u.ok)throw new Error(`Request failed: ${u.status}`);if(u.status!==204)return u.json()},[n,d,j]),m=s.useCallback(async()=>{f(!0),l(null);try{const t=new URLSearchParams({limit:"100"});h!=="all"&&t.set("status",h);const i=await r(`/admin/webhooks?${t.toString()}`);p(i.webhooks??[]),W(i.count??0)}catch{l("Failed to load webhooks"),p([])}finally{f(!1)}},[r,h]);s.useEffect(()=>{m()},[m]);const b=s.useCallback(async()=>{v(!0),l(null);try{const t=await r("/admin/webhooks/dlq?limit=100");g(t.webhooks??[]),T(t.count??0),A(!0)}catch{l("Failed to load DLQ webhooks"),g([])}finally{v(!1)}},[r]),R=t=>{L(t),l(null),o(null),t==="dlq"&&!w&&b()},I=async t=>{o(null);try{await r(`/admin/webhooks/${encodeURIComponent(t)}/retry`,{method:"POST"}),m()}catch{o("Failed to retry webhook")}},B=async t=>{if(window.confirm("Delete this webhook?")){o(null);try{await r(`/admin/webhooks/${encodeURIComponent(t)}`,{method:"DELETE"}),m()}catch{o("Failed to delete webhook")}}},Q=async t=>{o(null);try{await r(`/admin/webhooks/dlq/${encodeURIComponent(t)}/retry`,{method:"POST"}),b()}catch{o("Failed to retry DLQ webhook")}},P=async t=>{if(window.confirm("Delete this DLQ entry?")){o(null);try{await r(`/admin/webhooks/dlq/${encodeURIComponent(t)}`,{method:"DELETE"}),b()}catch{o("Failed to delete DLQ entry")}}};return e.jsxs("div",{children:[e.jsx("div",{className:"cedros-admin__section-header",children:e.jsx("h3",{className:"cedros-admin__section-title",children:"Webhooks"})}),e.jsx(D.ErrorBanner,{message:$}),e.jsx(D.ErrorBanner,{message:z}),e.jsx("div",{style:{display:"flex",gap:"0.25rem",marginBottom:"1rem",borderBottom:"1px solid var(--cedros-admin-border, #e0e0e0)"},children:["active","dlq"].map(t=>e.jsx("button",{type:"button",onClick:()=>R(t),style:{padding:"0.5rem 1rem",fontSize:"0.85rem",fontWeight:a===t?600:400,background:"none",border:"none",borderBottom:a===t?"2px solid var(--cedros-admin-primary, #000)":"2px solid transparent",cursor:"pointer",color:a===t?"var(--cedros-admin-text, #333)":"var(--cedros-admin-text-muted, #888)",marginBottom:"-1px"},children:t==="active"?`Active Webhooks${c>0?` (${c})`:""}`:`Dead Letter Queue${k>0?` (${k})`:""}`},t))}),a==="active"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1rem",alignItems:"center"},children:[e.jsxs("select",{className:"cedros-admin__input",value:h,onChange:t=>{C(t.target.value)},style:{width:"auto",fontSize:"0.85rem"},children:[e.jsx("option",{value:"all",children:"All statuses"}),e.jsx("option",{value:"pending",children:"Pending"}),e.jsx("option",{value:"processing",children:"Processing"}),e.jsx("option",{value:"failed",children:"Failed"}),e.jsx("option",{value:"success",children:"Success"})]}),e.jsxs("span",{style:{fontSize:"0.85rem",color:"var(--cedros-admin-text-muted, #888)"},children:[c," webhook",c!==1?"s":""]})]}),N?e.jsxs("div",{className:"cedros-admin__loading",children:[q.Icons.loading," Loading webhooks..."]}):y.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"No webhooks found."}):e.jsx("div",{className:"cedros-admin__table-container",children:e.jsxs("table",{className:"cedros-admin__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"URL"}),e.jsx("th",{children:"Event Type"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Attempts"}),e.jsx("th",{children:"Last Error"}),e.jsx("th",{children:"Created"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:y.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{maxWidth:"200px"},children:e.jsx("span",{title:t.url,style:{fontSize:"0.8rem",fontFamily:"monospace"},children:x(t.url,40)})}),e.jsx("td",{style:{fontSize:"0.85rem"},children:t.eventType}),e.jsx("td",{children:e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${U(t.status)}`,children:t.status})}),e.jsxs("td",{style:{fontSize:"0.85rem"},children:[t.attempts,"/",t.maxAttempts]}),e.jsx("td",{style:{fontSize:"0.8rem",maxWidth:"180px",color:"var(--cedros-admin-text-muted, #888)"},children:t.lastError?e.jsx("span",{title:t.lastError,children:x(t.lastError,40)}):"—"}),e.jsx("td",{style:{fontSize:"0.8rem"},children:E.formatDateTime(t.createdAt)}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",gap:"0.25rem"},children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>I(t.id),children:"Retry"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>B(t.id),style:{color:"var(--cedros-admin-danger, #c00)"},children:"Delete"})]})})]},t.id))})]})})]}),a==="dlq"&&e.jsx(e.Fragment,{children:F?e.jsxs("div",{className:"cedros-admin__loading",children:[q.Icons.loading," Loading DLQ..."]}):_.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"Dead Letter Queue is empty."}):e.jsx("div",{className:"cedros-admin__table-container",children:e.jsxs("table",{className:"cedros-admin__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"URL"}),e.jsx("th",{children:"Event Type"}),e.jsx("th",{children:"Attempts"}),e.jsx("th",{children:"Final Error"}),e.jsx("th",{children:"Moved to DLQ"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:_.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{maxWidth:"200px"},children:e.jsx("span",{title:t.url,style:{fontSize:"0.8rem",fontFamily:"monospace"},children:x(t.url,40)})}),e.jsx("td",{style:{fontSize:"0.85rem"},children:t.eventType}),e.jsx("td",{style:{fontSize:"0.85rem"},children:t.totalAttempts}),e.jsx("td",{style:{fontSize:"0.8rem",maxWidth:"200px",color:"var(--cedros-admin-text-muted, #888)"},children:e.jsx("span",{title:t.finalError,children:x(t.finalError,40)})}),e.jsx("td",{style:{fontSize:"0.8rem"},children:E.formatDateTime(t.movedToDlqAt)}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",gap:"0.25rem"},children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>Q(t.id),children:"Retry"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>P(t.id),style:{color:"var(--cedros-admin-danger, #c00)"},children:"Delete"})]})})]},t.id))})]})})})]})}exports.WebhooksSection=O;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),q=require("./plugin-DNhaPAbC.js"),D=require("./ErrorBanner-BOS1XAPu.js"),E=require("./dateHelpers-BKW_lGND.js"),U=n=>n==="success"?"success":n==="failed"?"failed":n==="pending"||n==="processing"?"pending":"muted",x=(n,d=48)=>n.length>d?`${n.slice(0,d)}…`:n;function O({serverUrl:n,apiKey:d,authManager:j}){const[a,L]=s.useState("active"),[y,p]=s.useState([]),[c,W]=s.useState(0),[h,C]=s.useState("all"),[N,f]=s.useState(!0),[_,g]=s.useState([]),[k,T]=s.useState(0),[F,v]=s.useState(!1),[w,A]=s.useState(!1),[$,l]=s.useState(null),[z,o]=s.useState(null),r=s.useCallback(async(t,i)=>{if(j?.isAuthenticated())return j.fetchWithAuth(t,i);const S={"Content-Type":"application/json"};d&&(S["X-API-Key"]=d);const u=await fetch(`${n}${t}`,{...i,headers:{...S,...i?.headers}});if(!u.ok)throw new Error(`Request failed: ${u.status}`);if(u.status!==204)return u.json()},[n,d,j]),m=s.useCallback(async()=>{f(!0),l(null);try{const t=new URLSearchParams({limit:"100"});h!=="all"&&t.set("status",h);const i=await r(`/admin/webhooks?${t.toString()}`);p(i.webhooks??[]),W(i.count??0)}catch{l("Failed to load webhooks"),p([])}finally{f(!1)}},[r,h]);s.useEffect(()=>{m()},[m]);const b=s.useCallback(async()=>{v(!0),l(null);try{const t=await r("/admin/webhooks/dlq?limit=100");g(t.webhooks??[]),T(t.count??0),A(!0)}catch{l("Failed to load DLQ webhooks"),g([])}finally{v(!1)}},[r]),R=t=>{L(t),l(null),o(null),t==="dlq"&&!w&&b()},I=async t=>{o(null);try{await r(`/admin/webhooks/${encodeURIComponent(t)}/retry`,{method:"POST"}),m()}catch{o("Failed to retry webhook")}},B=async t=>{if(window.confirm("Delete this webhook?")){o(null);try{await r(`/admin/webhooks/${encodeURIComponent(t)}`,{method:"DELETE"}),m()}catch{o("Failed to delete webhook")}}},Q=async t=>{o(null);try{await r(`/admin/webhooks/dlq/${encodeURIComponent(t)}/retry`,{method:"POST"}),b()}catch{o("Failed to retry DLQ webhook")}},P=async t=>{if(window.confirm("Delete this DLQ entry?")){o(null);try{await r(`/admin/webhooks/dlq/${encodeURIComponent(t)}`,{method:"DELETE"}),b()}catch{o("Failed to delete DLQ entry")}}};return e.jsxs("div",{children:[e.jsx("div",{className:"cedros-admin__section-header",children:e.jsx("h3",{className:"cedros-admin__section-title",children:"Webhooks"})}),e.jsx(D.ErrorBanner,{message:$}),e.jsx(D.ErrorBanner,{message:z}),e.jsx("div",{style:{display:"flex",gap:"0.25rem",marginBottom:"1rem",borderBottom:"1px solid var(--cedros-admin-border, #e0e0e0)"},children:["active","dlq"].map(t=>e.jsx("button",{type:"button",onClick:()=>R(t),style:{padding:"0.5rem 1rem",fontSize:"0.85rem",fontWeight:a===t?600:400,background:"none",border:"none",borderBottom:a===t?"2px solid var(--cedros-admin-primary, #000)":"2px solid transparent",cursor:"pointer",color:a===t?"var(--cedros-admin-text, #333)":"var(--cedros-admin-text-muted, #888)",marginBottom:"-1px"},children:t==="active"?`Active Webhooks${c>0?` (${c})`:""}`:`Dead Letter Queue${k>0?` (${k})`:""}`},t))}),a==="active"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1rem",alignItems:"center"},children:[e.jsxs("select",{className:"cedros-admin__input",value:h,onChange:t=>{C(t.target.value)},style:{width:"auto",fontSize:"0.85rem"},children:[e.jsx("option",{value:"all",children:"All statuses"}),e.jsx("option",{value:"pending",children:"Pending"}),e.jsx("option",{value:"processing",children:"Processing"}),e.jsx("option",{value:"failed",children:"Failed"}),e.jsx("option",{value:"success",children:"Success"})]}),e.jsxs("span",{style:{fontSize:"0.85rem",color:"var(--cedros-admin-text-muted, #888)"},children:[c," webhook",c!==1?"s":""]})]}),N?e.jsxs("div",{className:"cedros-admin__loading",children:[q.Icons.loading," Loading webhooks..."]}):y.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"No webhooks found."}):e.jsx("div",{className:"cedros-admin__table-container",children:e.jsxs("table",{className:"cedros-admin__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"URL"}),e.jsx("th",{children:"Event Type"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Attempts"}),e.jsx("th",{children:"Last Error"}),e.jsx("th",{children:"Created"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:y.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{maxWidth:"200px"},children:e.jsx("span",{title:t.url,style:{fontSize:"0.8rem",fontFamily:"monospace"},children:x(t.url,40)})}),e.jsx("td",{style:{fontSize:"0.85rem"},children:t.eventType}),e.jsx("td",{children:e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${U(t.status)}`,children:t.status})}),e.jsxs("td",{style:{fontSize:"0.85rem"},children:[t.attempts,"/",t.maxAttempts]}),e.jsx("td",{style:{fontSize:"0.8rem",maxWidth:"180px",color:"var(--cedros-admin-text-muted, #888)"},children:t.lastError?e.jsx("span",{title:t.lastError,children:x(t.lastError,40)}):"—"}),e.jsx("td",{style:{fontSize:"0.8rem"},children:E.formatDateTime(t.createdAt)}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",gap:"0.25rem"},children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>I(t.id),children:"Retry"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>B(t.id),style:{color:"var(--cedros-admin-danger, #c00)"},children:"Delete"})]})})]},t.id))})]})})]}),a==="dlq"&&e.jsx(e.Fragment,{children:F?e.jsxs("div",{className:"cedros-admin__loading",children:[q.Icons.loading," Loading DLQ..."]}):_.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"Dead Letter Queue is empty."}):e.jsx("div",{className:"cedros-admin__table-container",children:e.jsxs("table",{className:"cedros-admin__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"URL"}),e.jsx("th",{children:"Event Type"}),e.jsx("th",{children:"Attempts"}),e.jsx("th",{children:"Final Error"}),e.jsx("th",{children:"Moved to DLQ"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:_.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{maxWidth:"200px"},children:e.jsx("span",{title:t.url,style:{fontSize:"0.8rem",fontFamily:"monospace"},children:x(t.url,40)})}),e.jsx("td",{style:{fontSize:"0.85rem"},children:t.eventType}),e.jsx("td",{style:{fontSize:"0.85rem"},children:t.totalAttempts}),e.jsx("td",{style:{fontSize:"0.8rem",maxWidth:"200px",color:"var(--cedros-admin-text-muted, #888)"},children:e.jsx("span",{title:t.finalError,children:x(t.finalError,40)})}),e.jsx("td",{style:{fontSize:"0.8rem"},children:E.formatDateTime(t.movedToDlqAt)}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",gap:"0.25rem"},children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>Q(t.id),children:"Retry"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>P(t.id),style:{color:"var(--cedros-admin-danger, #c00)"},children:"Delete"})]})})]},t.id))})]})})})]})}exports.WebhooksSection=O;
@@ -1,7 +1,7 @@
1
1
  import { jsxs as o, jsx as t, Fragment as q } from "react/jsx-runtime";
2
2
  import { useState as r, useCallback as _, useEffect as G } from "react";
3
- import { I as W } from "./plugin-BIkt3boU.mjs";
4
- import { E as C } from "./ErrorBanner-DAjYj6Dx.mjs";
3
+ import { I as W } from "./plugin-CuoGEYWr.mjs";
4
+ import { E as C } from "./ErrorBanner-7naZtdtD.mjs";
5
5
  import { f as N } from "./dateHelpers-yvPkofYQ.mjs";
6
6
  const H = (n) => n === "success" ? "success" : n === "failed" ? "failed" : n === "pending" || n === "processing" ? "pending" : "muted", p = (n, s = 48) => n.length > s ? `${n.slice(0, s)}…` : n;
7
7
  function M({ serverUrl: n, apiKey: s, authManager: y }) {
package/dist/admin.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./plugin-Dw8_Q8rE.js");exports.CEDROS_PAY_GROUPS=S.CEDROS_PAY_GROUPS;exports.CEDROS_PAY_SECTIONS=S.CEDROS_PAY_SECTIONS;exports.CEDROS_PAY_SECTION_IDS=S.CEDROS_PAY_SECTION_IDS;exports.cedrosPayPlugin=S.cedrosPayPlugin;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./plugin-DNhaPAbC.js");exports.CEDROS_PAY_GROUPS=S.CEDROS_PAY_GROUPS;exports.CEDROS_PAY_SECTIONS=S.CEDROS_PAY_SECTIONS;exports.CEDROS_PAY_SECTION_IDS=S.CEDROS_PAY_SECTION_IDS;exports.cedrosPayPlugin=S.cedrosPayPlugin;
package/dist/admin.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as a, a as C, b as O, c as P } from "./plugin-BIkt3boU.mjs";
1
+ import { C as a, a as C, b as O, c as P } from "./plugin-CuoGEYWr.mjs";
2
2
  export {
3
3
  a as CEDROS_PAY_GROUPS,
4
4
  C as CEDROS_PAY_SECTIONS,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./styles-BwaDljnz.js"),N=require("./index-DVxx_62C.js"),i=require("./CedrosContext-3Dz7_9Ct.js"),f=require("./fetchWithTimeout-CG0EKbhf.js"),ue=require("./CryptoButton-BQceZhbn.js"),S=require("react/jsx-runtime"),o=require("react"),$=require("@solana/wallet-adapter-react"),ce=require("@solana/wallet-adapter-base"),Re=require("@solana/wallet-adapter-react-ui"),de=require("./walletPool-BjTXX6Vn.js"),ge=require("./tokenMintValidator-DNBhoefh.js"),U=require("./plugin-Dw8_Q8rE.js");function pe(){const{subscriptionManager:n,x402Manager:d,walletManager:b}=i.useCedrosContext(),{publicKey:u,signTransaction:k}=$.useWallet(),[h,y]=o.useState({status:"idle",error:null,sessionId:null,subscriptionStatus:null,expiresAt:null}),[_,x]=o.useState(null),T=o.useRef(!1),R=o.useCallback(()=>{if(!u){const l="Wallet not connected";return y(r=>({...r,status:"error",error:l})),{valid:!1,error:l}}if(!k){const l="Wallet does not support signing";return y(r=>({...r,status:"error",error:l})),{valid:!1,error:l}}return{valid:!0}},[u,k]),B=o.useCallback(async l=>{if(!u)return y(r=>({...r,status:"error",error:"Wallet not connected"})),null;y(r=>({...r,status:"checking",error:null}));try{const r=await n.checkSubscriptionStatus({resource:l,userId:u.toString()});return y(a=>({...a,status:r.active?"success":"idle",subscriptionStatus:r.status,expiresAt:r.expiresAt||r.currentPeriodEnd||null})),r}catch(r){const a=i.formatError(r,"Failed to check subscription status");return y(g=>({...g,status:"error",error:a})),null}},[u,n]),W=o.useCallback(async(l,r,a)=>{y(g=>({...g,status:"loading",error:null}));try{const g=await n.requestSubscriptionQuote(l,r,a);return x(g),y(s=>({...s,status:"idle"})),g}catch(g){const s=i.formatError(g,"Failed to get subscription quote");return y(c=>({...c,status:"error",error:s})),null}},[n]),E=o.useCallback(async(l,r,a)=>{if(T.current)return{success:!1,error:"Payment already in progress"};const g=R();if(!g.valid)return{success:!1,error:g.error};T.current=!0,y(s=>({...s,status:"loading",error:null}));try{const s=await n.requestSubscriptionQuote(l,r,a);x(s);const c=s.requirement;if(!d.validateRequirement(c))throw new Error("Invalid subscription quote received from server");const P=!!c.extra?.feePayer;let C;if(P){const{transaction:w,blockhash:M}=await d.buildGaslessTransaction({resourceId:l,userWallet:u.toString(),feePayer:c.extra.feePayer,couponCode:a?.couponCode}),q=b.deserializeTransaction(w),A=await b.partiallySignTransaction({transaction:q,signTransaction:k,blockhash:M});C=await d.submitGaslessTransaction({resource:l,partialTx:A,couponCode:a?.couponCode,resourceType:"regular",requirement:c})}else{const w=await b.buildTransaction({requirement:c,payerPublicKey:u}),M=await b.signTransaction({transaction:w,signTransaction:k}),q=b.buildPaymentPayload({requirement:c,signedTx:M,payerPublicKey:u});C=await d.submitPayment({resource:l,payload:q,couponCode:a?.couponCode,resourceType:"regular"})}if(C.success){const w=await n.checkSubscriptionStatus({resource:l,userId:u.toString()});y({status:"success",error:null,sessionId:C.transactionId||null,subscriptionStatus:w.status,expiresAt:w.expiresAt||w.currentPeriodEnd||null})}else y(w=>({...w,status:"error",error:C.error||"Subscription payment failed"}));return C}catch(s){const c=i.formatError(s,"Subscription payment failed");return y(P=>({...P,status:"error",error:c})),{success:!1,error:c}}finally{T.current=!1}},[R,n,d,b,u,k]),v=o.useCallback(()=>{y({status:"idle",error:null,sessionId:null,subscriptionStatus:null,expiresAt:null}),x(null)},[]);return{...h,quote:_,checkStatus:B,requestQuote:W,processPayment:E,reset:v}}function xe({resource:n,interval:d,intervalDays:b,couponCode:u,label:k,disabled:h=!1,onAttempt:y,onSuccess:_,onError:x,className:T="",testPageUrl:R,hideMessages:B=!1,autoCheckStatus:W=!0}){const{connected:E,connecting:v,connect:l,disconnect:r,select:a,wallets:g,wallet:s,publicKey:c}=$.useWallet(),{status:P,error:C,subscriptionStatus:w,expiresAt:M,checkStatus:q,processPayment:A}=pe(),p=i.useCedrosTheme(),{solanaError:I}=i.useCedrosContext(),{t:L,translations:Q}=e.useTranslation(),me=k||L("ui.subscribe_with_crypto"),V=o.useRef(_),X=o.useRef(x),H=o.useRef(A),J=o.useRef(q);V.current=_,X.current=x,H.current=A,J.current=q;const fe=C&&typeof C!="string"?C?.code??null:null,ye=I&&typeof I!="string"?I?.code??null:null,Z=t=>{if(!t||!Q)return"";const m=Q.errors[t];return m?m.action?`${m.message} ${m.action}`:m.message:""},ee=C?typeof C=="string"?C:Z(fe):null,te=I?typeof I=="string"?I:Z(ye):null,be=o.useMemo(()=>g.map(t=>`${t.adapter.name}-${t.readyState}`).join(","),[g]),z=o.useMemo(()=>g.filter(({readyState:t})=>t===ce.WalletReadyState.Installed||t===ce.WalletReadyState.Loadable),[be]);o.useEffect(()=>{W&&E&&c&&(f.getLogger().debug("[CryptoSubscribeButton] Auto-checking subscription status"),J.current(n))},[W,E,c,n]),o.useEffect(()=>{P==="success"&&w==="active"&&(e.emitPaymentSuccess("crypto","subscription-active",n),V.current?.("subscription-active"))},[P,w,n]),o.useEffect(()=>{P==="error"&&C&&(e.emitPaymentError("crypto",C,n),X.current?.(C))},[P,C,n]);const re=typeof window<"u"&&window.top!==window.self,[ne,F]=o.useState(!1),[oe,Y]=o.useState(!1),[ae,O]=o.useState(!1),D=I;o.useEffect(()=>{let t=!1;return t||(async()=>{if(oe&&s&&!E&&!v){f.getLogger().debug("[CryptoSubscribeButton] Wallet detected, attempting auto-connect:",s.adapter.name),Y(!1),e.emitWalletConnect(s.adapter.name);try{await l(),t||f.getLogger().debug("[CryptoSubscribeButton] Auto-connect successful")}catch(K){if(!t){f.getLogger().error("[CryptoSubscribeButton] Auto-connect failed:",K);const we=K instanceof Error?K.message:"Failed to connect wallet";e.emitWalletError(we,s.adapter.name),O(!1)}}}})(),()=>{t=!0}},[s,oe,E,v,l]),o.useEffect(()=>{E&&ae&&c&&s&&(e.emitWalletConnected(s.adapter.name,c.toString()),f.getLogger().debug("[CryptoSubscribeButton] Processing pending subscription payment"),O(!1),F(!1),e.emitPaymentProcessing("crypto",n),H.current(n,d,{couponCode:u,intervalDays:b}))},[E,ae,c,s,n,d,u,b]);const se=o.useCallback(async()=>{if(f.getLogger().debug("[CryptoSubscribeButton] executeSubscriptionFlow called",{connected:E,wallet:s?.adapter.name,resource:n,interval:d}),e.emitPaymentStart("crypto",n),y&&y("crypto"),D){f.getLogger().error("[CryptoSubscribeButton] Solana dependencies missing:",D),e.emitPaymentError("crypto",D,n),x&&x(D);return}if(re){const t=R||window.location.href;try{if(new URL(t,window.location.origin).origin!==window.location.origin)throw f.getLogger().error("[CryptoSubscribeButton] Blocked attempt to open external URL:",t),new Error("Cannot open external URLs from embedded context");window.open(t,"_blank","noopener,noreferrer")}catch(m){throw f.getLogger().error("[CryptoSubscribeButton] URL validation failed:",m),m}return}if(E)e.emitPaymentProcessing("crypto",n),await A(n,d,{couponCode:u,intervalDays:b});else{O(!0);try{if(s)f.getLogger().debug("[CryptoSubscribeButton] Wallet already selected, connecting:",s.adapter.name),e.emitWalletConnect(s.adapter.name),await l();else{if(f.getLogger().debug("[CryptoSubscribeButton] No wallet selected, showing selector"),z.length===0){O(!1);const t="No wallets available";throw e.emitWalletError(t),new Error(t)}F(!0)}}catch(t){O(!1);const m=t instanceof Error?t.message:"Failed to connect wallet";f.getLogger().error("[CryptoSubscribeButton] Connection error:",m),e.emitWalletError(m,s?.adapter.name)}}},[E,s,n,d,u,b,re,R,z,l,A,D,y,x]),ie=o.useMemo(()=>`crypto-subscribe-${n}-${d}`,[n,d]),Ce=o.useMemo(()=>e.createDedupedClickHandler(ie,se,{cooldownMs:200,deduplicationWindowMs:0}),[ie,se]),le=P==="loading"||P==="checking",j=w==="active"||w==="trialing",Se=h||le||v||!!D||j;let G=me;if(le)G=L("ui.processing");else if(j&&M){const t=new Date(M).toLocaleDateString();G=`${L("ui.subscribed_until")} ${t}`}else j&&(G=L("ui.subscribed"));const Ee=o.useCallback(async()=>{try{Y(!1),E&&await r(),a(null),F(!0)}catch(t){f.getLogger().error("Failed to change wallet:",t)}},[E,r,a]),Pe=o.useCallback(t=>{f.getLogger().debug("[CryptoSubscribeButton] Wallet clicked:",t),F(!1),a(t),Y(!0)},[a]),he=o.useCallback(async()=>{try{if(await r(),O(!1),typeof window<"u"&&window.localStorage)try{window.localStorage.removeItem("walletName")}catch(t){t instanceof Error&&t.name==="QuotaExceededError"?f.getLogger().warn("localStorage quota exceeded when removing wallet preference"):f.getLogger().error("Failed to clear wallet preference from localStorage:",t)}}catch(t){f.getLogger().error("Failed to disconnect wallet:",t)}},[r]);return S.jsxs("div",{className:p.unstyled?T:`${p.className} cedros-theme__crypto-button ${T||""}`,style:p.unstyled?{}:p.style,children:[S.jsx("button",{onClick:Ce,disabled:Se,className:p.unstyled?T:"cedros-theme__button cedros-theme__crypto",type:"button",children:G}),ne&&!B&&S.jsx("div",{className:"cedros-modal-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:p.tokens.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem"},onClick:()=>F(!1),children:S.jsxs("div",{className:"cedros-modal-content",style:{backgroundColor:p.tokens.modalBackground,borderRadius:"12px",padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",border:`1px solid ${p.tokens.modalBorder}`},onClick:t=>t.stopPropagation(),children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.5rem"},children:[S.jsx("h3",{style:{margin:0,fontSize:"1.25rem",fontWeight:600,color:p.tokens.surfaceText},children:L("wallet.select_wallet")}),S.jsx("button",{onClick:()=>F(!1),style:e.getModalCloseButtonStyles(p.tokens.surfaceText),"aria-label":"Close modal",type:"button",children:"×"})]}),S.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:z.map(t=>S.jsxs("button",{onClick:()=>Pe(t.adapter.name),style:{width:"100%",padding:"1rem",backgroundColor:p.tokens.surfaceBackground,border:`1px solid ${p.tokens.surfaceBorder}`,borderRadius:"0.5rem",cursor:"pointer",fontSize:"1rem",textAlign:"left",color:p.tokens.surfaceText,display:"flex",alignItems:"center",gap:"1rem",transition:"all 0.2s ease"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=p.tokens.modalBackground,m.currentTarget.style.borderColor=p.tokens.surfaceText,m.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:m=>{m.currentTarget.style.backgroundColor=p.tokens.surfaceBackground,m.currentTarget.style.borderColor=p.tokens.surfaceBorder,m.currentTarget.style.transform="translateY(0)"},type:"button",children:[S.jsx(Re.WalletIcon,{wallet:t,style:{width:"24px",height:"24px"}}),S.jsx("span",{style:{fontWeight:500},children:t.adapter.name})]},t.adapter.name))})]})}),E&&!B&&!ne&&S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.5rem",fontSize:"0.75rem",color:p.tokens.surfaceText,opacity:.7},children:[S.jsx("button",{onClick:Ee,style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"none",cursor:"pointer",fontSize:"inherit"},type:"button",children:L("wallet.change")}),S.jsx("button",{onClick:he,style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"none",cursor:"pointer",fontSize:"inherit"},type:"button",children:L("ui.disconnect")})]}),!B&&te&&S.jsx("div",{className:p.unstyled?"":"cedros-theme__error",children:te}),!B&&ee&&S.jsx("div",{className:p.unstyled?"":"cedros-theme__error",children:ee}),!B&&j&&S.jsx("div",{className:p.unstyled?"":"cedros-theme__success",children:L("ui.subscription_active")})]})}function Te(){const{x402Manager:n,walletManager:d}=i.useCedrosContext(),{publicKey:b,signTransaction:u}=$.useWallet(),[k,h]=o.useState({status:"idle",error:null,transactionId:null}),[y,_]=o.useState(null),[x,T]=o.useState(null),R=o.useRef(!1),B=o.useCallback(async l=>{try{h(a=>({...a,status:"loading"}));const r=await n.requestQuote({resource:l});if(!n.validateRequirement(r))throw new Error("Invalid refund requirement received from server");return _(r),h(a=>({...a,status:"idle"})),r}catch(r){const a=i.formatError(r,"Failed to fetch refund requirement");throw h({status:"error",error:a,transactionId:null}),r}},[n]),W=o.useCallback(async(l,r)=>{if(R.current)throw new Error("Refund already in progress");if(!b||!u)throw new Error("Wallet not connected");R.current=!0;try{h({status:"loading",error:null,transactionId:null});const a=await n.requestQuote({resource:l,couponCode:r});if(!n.validateRequirement(a))throw new Error("Invalid refund requirement received");_(a);const g=await d.buildTransaction({requirement:a,payerPublicKey:b}),s=await d.signTransaction({transaction:g,signTransaction:u}),c=d.buildPaymentPayload({requirement:a,signedTx:s,payerPublicKey:b}),P=await n.submitPayment({resource:l,payload:c,couponCode:r,metadata:void 0,resourceType:"refund"});return P.settlement&&T(P.settlement),h({status:"success",error:null,transactionId:P.transactionId||s.signature}),P}catch(a){const g=i.formatError(a,"Refund payment failed");throw h({status:"error",error:g,transactionId:null}),a}finally{R.current=!1}},[b,u,n,d]),E=o.useCallback(async l=>{if(R.current)throw new Error("Refund already in progress");if(!b||!u)throw new Error("Wallet not connected");R.current=!0;try{h({status:"loading",error:null,transactionId:null});const r=await n.requestQuote({resource:l});if(!n.validateRequirement(r))throw new Error("Invalid refund requirement received");_(r);const{transaction:a}=await n.buildGaslessTransaction({resourceId:l,userWallet:b.toString(),feePayer:r.extra.feePayer}),g=d.deserializeTransaction(a),s=await d.partiallySignTransaction({transaction:g,signTransaction:u}),c=await n.submitGaslessTransaction({resource:l,partialTx:s,couponCode:void 0,metadata:void 0,resourceType:"refund",requirement:r});return c.settlement&&T(c.settlement),h({status:"success",error:null,transactionId:c.transactionId||"gasless-refund-tx"}),c}catch(r){const a=i.formatError(r,"Gasless refund payment failed");throw h({status:"error",error:a,transactionId:null}),r}finally{R.current=!1}},[b,u,n,d]),v=o.useCallback(()=>{h({status:"idle",error:null,transactionId:null}),_(null),T(null)},[]);return{state:k,requirement:y,settlement:x,fetchRefundQuote:B,processRefund:W,processGaslessRefund:E,reset:v}}exports.CEDROS_EVENTS=e.CEDROS_EVENTS;exports.CSP_PRESETS=e.CSP_PRESETS;exports.CedrosPay=e.CedrosPay;exports.CreditsButton=e.CreditsButton;exports.CreditsSubscribeButton=e.CreditsSubscribeButton;exports.PaymentMethodBadge=e.PaymentMethodBadge;exports.PaymentModal=e.PaymentModal;exports.ProductPrice=e.ProductPrice;exports.PurchaseButton=e.PurchaseButton;exports.RPC_PROVIDERS=e.RPC_PROVIDERS;exports.SECURITY_RECOMMENDATIONS=e.SECURITY_RECOMMENDATIONS;exports.StripeButton=e.StripeButton;exports.SubscribeButton=e.SubscribeButton;exports.SubscriptionManagementPanel=e.SubscriptionManagementPanel;exports.calculateDiscountPercentage=e.calculateDiscountPercentage;exports.createTranslator=e.createTranslator;exports.detectLocale=e.detectLocale;exports.emitPaymentError=e.emitPaymentError;exports.emitPaymentProcessing=e.emitPaymentProcessing;exports.emitPaymentStart=e.emitPaymentStart;exports.emitPaymentSuccess=e.emitPaymentSuccess;exports.emitWalletConnect=e.emitWalletConnect;exports.emitWalletConnected=e.emitWalletConnected;exports.emitWalletError=e.emitWalletError;exports.formatCSP=e.formatCSP;exports.formatCouponCodes=e.formatCouponCodes;exports.generateCSP=e.generateCSP;exports.generateCSPDirectives=e.generateCSPDirectives;exports.getAvailableLocales=e.getAvailableLocales;exports.getLocalizedError=e.getLocalizedError;exports.getUserErrorMessage=e.getUserErrorMessage;exports.isRetryableError=e.isRetryableError;exports.loadLocale=e.loadLocale;exports.logSecurityReport=e.logSecurityReport;exports.parseCouponCodes=e.parseCouponCodes;exports.stackCheckoutCoupons=e.stackCheckoutCoupons;exports.useCreditsPayment=e.useCreditsPayment;exports.useCreditsSubscription=e.useCreditsSubscription;exports.useLocalizedError=e.useLocalizedError;exports.usePaymentMode=e.usePaymentMode;exports.useStripeCheckout=e.useStripeCheckout;exports.useSubscription=e.useSubscription;exports.useSubscriptionManagement=e.useSubscriptionManagement;exports.useTranslation=e.useTranslation;exports.validateSecurity=e.validateSecurity;exports.ComplianceGatePage=N.ComplianceGatePage;exports.CreditsBalance=N.CreditsBalance;exports.ecommerce=N.index;exports.useComplianceCheck=N.useComplianceCheck;exports.useCreditsBalance=N.useCreditsBalance;exports.CIRCUIT_BREAKER_PRESETS=i.CIRCUIT_BREAKER_PRESETS;exports.CedrosProvider=i.CedrosProvider;exports.CircuitBreakerOpenError=i.CircuitBreakerOpenError;exports.CircuitState=i.CircuitState;exports.ERROR_CATEGORIES=i.ERROR_CATEGORIES;exports.FEATURE_FLAG_NAMES=i.FEATURE_FLAG_NAMES;exports.FEATURE_FLAG_REGISTRY=i.FEATURE_FLAG_REGISTRY;exports.RATE_LIMITER_PRESETS=i.RATE_LIMITER_PRESETS;exports.RETRY_PRESETS=i.RETRY_PRESETS;exports.createCircuitBreaker=i.createCircuitBreaker;exports.createRateLimiter=i.createRateLimiter;exports.getFeatureFlagDefinition=i.getFeatureFlagDefinition;exports.getFeatureFlagDefinitions=i.getFeatureFlagDefinitions;exports.isFeatureEnabled=i.isFeatureEnabled;exports.parseFeatureFlagBoolean=i.parseFeatureFlagBoolean;exports.resolveFeatureFlags=i.resolveFeatureFlags;exports.retryWithBackoff=i.retryWithBackoff;exports.useCedrosContext=i.useCedrosContext;exports.useCedrosTheme=i.useCedrosTheme;exports.validateConfig=i.validateConfig;exports.LogLevel=f.LogLevel;exports.Logger=f.Logger;exports.createLogger=f.createLogger;exports.getLogger=f.getLogger;exports.CryptoButton=ue.CryptoButton;exports.useX402Payment=ue.useX402Payment;exports.WalletPool=de.WalletPool;exports.createWalletPool=de.createWalletPool;exports.KNOWN_STABLECOINS=ge.KNOWN_STABLECOINS;exports.validateTokenMint=ge.validateTokenMint;exports.CEDROS_PAY_GROUPS=U.CEDROS_PAY_GROUPS;exports.CEDROS_PAY_SECTIONS=U.CEDROS_PAY_SECTIONS;exports.CEDROS_PAY_SECTION_IDS=U.CEDROS_PAY_SECTION_IDS;exports.cedrosPayPlugin=U.cedrosPayPlugin;exports.CryptoSubscribeButton=xe;exports.useCryptoSubscription=pe;exports.useRefundVerification=Te;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./styles-BwaDljnz.js"),N=require("./index-DVxx_62C.js"),i=require("./CedrosContext-3Dz7_9Ct.js"),f=require("./fetchWithTimeout-CG0EKbhf.js"),ue=require("./CryptoButton-BQceZhbn.js"),S=require("react/jsx-runtime"),o=require("react"),$=require("@solana/wallet-adapter-react"),ce=require("@solana/wallet-adapter-base"),Re=require("@solana/wallet-adapter-react-ui"),de=require("./walletPool-BjTXX6Vn.js"),ge=require("./tokenMintValidator-DNBhoefh.js"),U=require("./plugin-DNhaPAbC.js");function pe(){const{subscriptionManager:n,x402Manager:d,walletManager:b}=i.useCedrosContext(),{publicKey:u,signTransaction:k}=$.useWallet(),[h,y]=o.useState({status:"idle",error:null,sessionId:null,subscriptionStatus:null,expiresAt:null}),[_,x]=o.useState(null),T=o.useRef(!1),R=o.useCallback(()=>{if(!u){const l="Wallet not connected";return y(r=>({...r,status:"error",error:l})),{valid:!1,error:l}}if(!k){const l="Wallet does not support signing";return y(r=>({...r,status:"error",error:l})),{valid:!1,error:l}}return{valid:!0}},[u,k]),B=o.useCallback(async l=>{if(!u)return y(r=>({...r,status:"error",error:"Wallet not connected"})),null;y(r=>({...r,status:"checking",error:null}));try{const r=await n.checkSubscriptionStatus({resource:l,userId:u.toString()});return y(a=>({...a,status:r.active?"success":"idle",subscriptionStatus:r.status,expiresAt:r.expiresAt||r.currentPeriodEnd||null})),r}catch(r){const a=i.formatError(r,"Failed to check subscription status");return y(g=>({...g,status:"error",error:a})),null}},[u,n]),W=o.useCallback(async(l,r,a)=>{y(g=>({...g,status:"loading",error:null}));try{const g=await n.requestSubscriptionQuote(l,r,a);return x(g),y(s=>({...s,status:"idle"})),g}catch(g){const s=i.formatError(g,"Failed to get subscription quote");return y(c=>({...c,status:"error",error:s})),null}},[n]),E=o.useCallback(async(l,r,a)=>{if(T.current)return{success:!1,error:"Payment already in progress"};const g=R();if(!g.valid)return{success:!1,error:g.error};T.current=!0,y(s=>({...s,status:"loading",error:null}));try{const s=await n.requestSubscriptionQuote(l,r,a);x(s);const c=s.requirement;if(!d.validateRequirement(c))throw new Error("Invalid subscription quote received from server");const P=!!c.extra?.feePayer;let C;if(P){const{transaction:w,blockhash:M}=await d.buildGaslessTransaction({resourceId:l,userWallet:u.toString(),feePayer:c.extra.feePayer,couponCode:a?.couponCode}),q=b.deserializeTransaction(w),A=await b.partiallySignTransaction({transaction:q,signTransaction:k,blockhash:M});C=await d.submitGaslessTransaction({resource:l,partialTx:A,couponCode:a?.couponCode,resourceType:"regular",requirement:c})}else{const w=await b.buildTransaction({requirement:c,payerPublicKey:u}),M=await b.signTransaction({transaction:w,signTransaction:k}),q=b.buildPaymentPayload({requirement:c,signedTx:M,payerPublicKey:u});C=await d.submitPayment({resource:l,payload:q,couponCode:a?.couponCode,resourceType:"regular"})}if(C.success){const w=await n.checkSubscriptionStatus({resource:l,userId:u.toString()});y({status:"success",error:null,sessionId:C.transactionId||null,subscriptionStatus:w.status,expiresAt:w.expiresAt||w.currentPeriodEnd||null})}else y(w=>({...w,status:"error",error:C.error||"Subscription payment failed"}));return C}catch(s){const c=i.formatError(s,"Subscription payment failed");return y(P=>({...P,status:"error",error:c})),{success:!1,error:c}}finally{T.current=!1}},[R,n,d,b,u,k]),v=o.useCallback(()=>{y({status:"idle",error:null,sessionId:null,subscriptionStatus:null,expiresAt:null}),x(null)},[]);return{...h,quote:_,checkStatus:B,requestQuote:W,processPayment:E,reset:v}}function xe({resource:n,interval:d,intervalDays:b,couponCode:u,label:k,disabled:h=!1,onAttempt:y,onSuccess:_,onError:x,className:T="",testPageUrl:R,hideMessages:B=!1,autoCheckStatus:W=!0}){const{connected:E,connecting:v,connect:l,disconnect:r,select:a,wallets:g,wallet:s,publicKey:c}=$.useWallet(),{status:P,error:C,subscriptionStatus:w,expiresAt:M,checkStatus:q,processPayment:A}=pe(),p=i.useCedrosTheme(),{solanaError:I}=i.useCedrosContext(),{t:L,translations:Q}=e.useTranslation(),me=k||L("ui.subscribe_with_crypto"),V=o.useRef(_),X=o.useRef(x),H=o.useRef(A),J=o.useRef(q);V.current=_,X.current=x,H.current=A,J.current=q;const fe=C&&typeof C!="string"?C?.code??null:null,ye=I&&typeof I!="string"?I?.code??null:null,Z=t=>{if(!t||!Q)return"";const m=Q.errors[t];return m?m.action?`${m.message} ${m.action}`:m.message:""},ee=C?typeof C=="string"?C:Z(fe):null,te=I?typeof I=="string"?I:Z(ye):null,be=o.useMemo(()=>g.map(t=>`${t.adapter.name}-${t.readyState}`).join(","),[g]),z=o.useMemo(()=>g.filter(({readyState:t})=>t===ce.WalletReadyState.Installed||t===ce.WalletReadyState.Loadable),[be]);o.useEffect(()=>{W&&E&&c&&(f.getLogger().debug("[CryptoSubscribeButton] Auto-checking subscription status"),J.current(n))},[W,E,c,n]),o.useEffect(()=>{P==="success"&&w==="active"&&(e.emitPaymentSuccess("crypto","subscription-active",n),V.current?.("subscription-active"))},[P,w,n]),o.useEffect(()=>{P==="error"&&C&&(e.emitPaymentError("crypto",C,n),X.current?.(C))},[P,C,n]);const re=typeof window<"u"&&window.top!==window.self,[ne,F]=o.useState(!1),[oe,Y]=o.useState(!1),[ae,O]=o.useState(!1),D=I;o.useEffect(()=>{let t=!1;return t||(async()=>{if(oe&&s&&!E&&!v){f.getLogger().debug("[CryptoSubscribeButton] Wallet detected, attempting auto-connect:",s.adapter.name),Y(!1),e.emitWalletConnect(s.adapter.name);try{await l(),t||f.getLogger().debug("[CryptoSubscribeButton] Auto-connect successful")}catch(K){if(!t){f.getLogger().error("[CryptoSubscribeButton] Auto-connect failed:",K);const we=K instanceof Error?K.message:"Failed to connect wallet";e.emitWalletError(we,s.adapter.name),O(!1)}}}})(),()=>{t=!0}},[s,oe,E,v,l]),o.useEffect(()=>{E&&ae&&c&&s&&(e.emitWalletConnected(s.adapter.name,c.toString()),f.getLogger().debug("[CryptoSubscribeButton] Processing pending subscription payment"),O(!1),F(!1),e.emitPaymentProcessing("crypto",n),H.current(n,d,{couponCode:u,intervalDays:b}))},[E,ae,c,s,n,d,u,b]);const se=o.useCallback(async()=>{if(f.getLogger().debug("[CryptoSubscribeButton] executeSubscriptionFlow called",{connected:E,wallet:s?.adapter.name,resource:n,interval:d}),e.emitPaymentStart("crypto",n),y&&y("crypto"),D){f.getLogger().error("[CryptoSubscribeButton] Solana dependencies missing:",D),e.emitPaymentError("crypto",D,n),x&&x(D);return}if(re){const t=R||window.location.href;try{if(new URL(t,window.location.origin).origin!==window.location.origin)throw f.getLogger().error("[CryptoSubscribeButton] Blocked attempt to open external URL:",t),new Error("Cannot open external URLs from embedded context");window.open(t,"_blank","noopener,noreferrer")}catch(m){throw f.getLogger().error("[CryptoSubscribeButton] URL validation failed:",m),m}return}if(E)e.emitPaymentProcessing("crypto",n),await A(n,d,{couponCode:u,intervalDays:b});else{O(!0);try{if(s)f.getLogger().debug("[CryptoSubscribeButton] Wallet already selected, connecting:",s.adapter.name),e.emitWalletConnect(s.adapter.name),await l();else{if(f.getLogger().debug("[CryptoSubscribeButton] No wallet selected, showing selector"),z.length===0){O(!1);const t="No wallets available";throw e.emitWalletError(t),new Error(t)}F(!0)}}catch(t){O(!1);const m=t instanceof Error?t.message:"Failed to connect wallet";f.getLogger().error("[CryptoSubscribeButton] Connection error:",m),e.emitWalletError(m,s?.adapter.name)}}},[E,s,n,d,u,b,re,R,z,l,A,D,y,x]),ie=o.useMemo(()=>`crypto-subscribe-${n}-${d}`,[n,d]),Ce=o.useMemo(()=>e.createDedupedClickHandler(ie,se,{cooldownMs:200,deduplicationWindowMs:0}),[ie,se]),le=P==="loading"||P==="checking",j=w==="active"||w==="trialing",Se=h||le||v||!!D||j;let G=me;if(le)G=L("ui.processing");else if(j&&M){const t=new Date(M).toLocaleDateString();G=`${L("ui.subscribed_until")} ${t}`}else j&&(G=L("ui.subscribed"));const Ee=o.useCallback(async()=>{try{Y(!1),E&&await r(),a(null),F(!0)}catch(t){f.getLogger().error("Failed to change wallet:",t)}},[E,r,a]),Pe=o.useCallback(t=>{f.getLogger().debug("[CryptoSubscribeButton] Wallet clicked:",t),F(!1),a(t),Y(!0)},[a]),he=o.useCallback(async()=>{try{if(await r(),O(!1),typeof window<"u"&&window.localStorage)try{window.localStorage.removeItem("walletName")}catch(t){t instanceof Error&&t.name==="QuotaExceededError"?f.getLogger().warn("localStorage quota exceeded when removing wallet preference"):f.getLogger().error("Failed to clear wallet preference from localStorage:",t)}}catch(t){f.getLogger().error("Failed to disconnect wallet:",t)}},[r]);return S.jsxs("div",{className:p.unstyled?T:`${p.className} cedros-theme__crypto-button ${T||""}`,style:p.unstyled?{}:p.style,children:[S.jsx("button",{onClick:Ce,disabled:Se,className:p.unstyled?T:"cedros-theme__button cedros-theme__crypto",type:"button",children:G}),ne&&!B&&S.jsx("div",{className:"cedros-modal-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:p.tokens.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem"},onClick:()=>F(!1),children:S.jsxs("div",{className:"cedros-modal-content",style:{backgroundColor:p.tokens.modalBackground,borderRadius:"12px",padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",border:`1px solid ${p.tokens.modalBorder}`},onClick:t=>t.stopPropagation(),children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.5rem"},children:[S.jsx("h3",{style:{margin:0,fontSize:"1.25rem",fontWeight:600,color:p.tokens.surfaceText},children:L("wallet.select_wallet")}),S.jsx("button",{onClick:()=>F(!1),style:e.getModalCloseButtonStyles(p.tokens.surfaceText),"aria-label":"Close modal",type:"button",children:"×"})]}),S.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:z.map(t=>S.jsxs("button",{onClick:()=>Pe(t.adapter.name),style:{width:"100%",padding:"1rem",backgroundColor:p.tokens.surfaceBackground,border:`1px solid ${p.tokens.surfaceBorder}`,borderRadius:"0.5rem",cursor:"pointer",fontSize:"1rem",textAlign:"left",color:p.tokens.surfaceText,display:"flex",alignItems:"center",gap:"1rem",transition:"all 0.2s ease"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=p.tokens.modalBackground,m.currentTarget.style.borderColor=p.tokens.surfaceText,m.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:m=>{m.currentTarget.style.backgroundColor=p.tokens.surfaceBackground,m.currentTarget.style.borderColor=p.tokens.surfaceBorder,m.currentTarget.style.transform="translateY(0)"},type:"button",children:[S.jsx(Re.WalletIcon,{wallet:t,style:{width:"24px",height:"24px"}}),S.jsx("span",{style:{fontWeight:500},children:t.adapter.name})]},t.adapter.name))})]})}),E&&!B&&!ne&&S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.5rem",fontSize:"0.75rem",color:p.tokens.surfaceText,opacity:.7},children:[S.jsx("button",{onClick:Ee,style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"none",cursor:"pointer",fontSize:"inherit"},type:"button",children:L("wallet.change")}),S.jsx("button",{onClick:he,style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"none",cursor:"pointer",fontSize:"inherit"},type:"button",children:L("ui.disconnect")})]}),!B&&te&&S.jsx("div",{className:p.unstyled?"":"cedros-theme__error",children:te}),!B&&ee&&S.jsx("div",{className:p.unstyled?"":"cedros-theme__error",children:ee}),!B&&j&&S.jsx("div",{className:p.unstyled?"":"cedros-theme__success",children:L("ui.subscription_active")})]})}function Te(){const{x402Manager:n,walletManager:d}=i.useCedrosContext(),{publicKey:b,signTransaction:u}=$.useWallet(),[k,h]=o.useState({status:"idle",error:null,transactionId:null}),[y,_]=o.useState(null),[x,T]=o.useState(null),R=o.useRef(!1),B=o.useCallback(async l=>{try{h(a=>({...a,status:"loading"}));const r=await n.requestQuote({resource:l});if(!n.validateRequirement(r))throw new Error("Invalid refund requirement received from server");return _(r),h(a=>({...a,status:"idle"})),r}catch(r){const a=i.formatError(r,"Failed to fetch refund requirement");throw h({status:"error",error:a,transactionId:null}),r}},[n]),W=o.useCallback(async(l,r)=>{if(R.current)throw new Error("Refund already in progress");if(!b||!u)throw new Error("Wallet not connected");R.current=!0;try{h({status:"loading",error:null,transactionId:null});const a=await n.requestQuote({resource:l,couponCode:r});if(!n.validateRequirement(a))throw new Error("Invalid refund requirement received");_(a);const g=await d.buildTransaction({requirement:a,payerPublicKey:b}),s=await d.signTransaction({transaction:g,signTransaction:u}),c=d.buildPaymentPayload({requirement:a,signedTx:s,payerPublicKey:b}),P=await n.submitPayment({resource:l,payload:c,couponCode:r,metadata:void 0,resourceType:"refund"});return P.settlement&&T(P.settlement),h({status:"success",error:null,transactionId:P.transactionId||s.signature}),P}catch(a){const g=i.formatError(a,"Refund payment failed");throw h({status:"error",error:g,transactionId:null}),a}finally{R.current=!1}},[b,u,n,d]),E=o.useCallback(async l=>{if(R.current)throw new Error("Refund already in progress");if(!b||!u)throw new Error("Wallet not connected");R.current=!0;try{h({status:"loading",error:null,transactionId:null});const r=await n.requestQuote({resource:l});if(!n.validateRequirement(r))throw new Error("Invalid refund requirement received");_(r);const{transaction:a}=await n.buildGaslessTransaction({resourceId:l,userWallet:b.toString(),feePayer:r.extra.feePayer}),g=d.deserializeTransaction(a),s=await d.partiallySignTransaction({transaction:g,signTransaction:u}),c=await n.submitGaslessTransaction({resource:l,partialTx:s,couponCode:void 0,metadata:void 0,resourceType:"refund",requirement:r});return c.settlement&&T(c.settlement),h({status:"success",error:null,transactionId:c.transactionId||"gasless-refund-tx"}),c}catch(r){const a=i.formatError(r,"Gasless refund payment failed");throw h({status:"error",error:a,transactionId:null}),r}finally{R.current=!1}},[b,u,n,d]),v=o.useCallback(()=>{h({status:"idle",error:null,transactionId:null}),_(null),T(null)},[]);return{state:k,requirement:y,settlement:x,fetchRefundQuote:B,processRefund:W,processGaslessRefund:E,reset:v}}exports.CEDROS_EVENTS=e.CEDROS_EVENTS;exports.CSP_PRESETS=e.CSP_PRESETS;exports.CedrosPay=e.CedrosPay;exports.CreditsButton=e.CreditsButton;exports.CreditsSubscribeButton=e.CreditsSubscribeButton;exports.PaymentMethodBadge=e.PaymentMethodBadge;exports.PaymentModal=e.PaymentModal;exports.ProductPrice=e.ProductPrice;exports.PurchaseButton=e.PurchaseButton;exports.RPC_PROVIDERS=e.RPC_PROVIDERS;exports.SECURITY_RECOMMENDATIONS=e.SECURITY_RECOMMENDATIONS;exports.StripeButton=e.StripeButton;exports.SubscribeButton=e.SubscribeButton;exports.SubscriptionManagementPanel=e.SubscriptionManagementPanel;exports.calculateDiscountPercentage=e.calculateDiscountPercentage;exports.createTranslator=e.createTranslator;exports.detectLocale=e.detectLocale;exports.emitPaymentError=e.emitPaymentError;exports.emitPaymentProcessing=e.emitPaymentProcessing;exports.emitPaymentStart=e.emitPaymentStart;exports.emitPaymentSuccess=e.emitPaymentSuccess;exports.emitWalletConnect=e.emitWalletConnect;exports.emitWalletConnected=e.emitWalletConnected;exports.emitWalletError=e.emitWalletError;exports.formatCSP=e.formatCSP;exports.formatCouponCodes=e.formatCouponCodes;exports.generateCSP=e.generateCSP;exports.generateCSPDirectives=e.generateCSPDirectives;exports.getAvailableLocales=e.getAvailableLocales;exports.getLocalizedError=e.getLocalizedError;exports.getUserErrorMessage=e.getUserErrorMessage;exports.isRetryableError=e.isRetryableError;exports.loadLocale=e.loadLocale;exports.logSecurityReport=e.logSecurityReport;exports.parseCouponCodes=e.parseCouponCodes;exports.stackCheckoutCoupons=e.stackCheckoutCoupons;exports.useCreditsPayment=e.useCreditsPayment;exports.useCreditsSubscription=e.useCreditsSubscription;exports.useLocalizedError=e.useLocalizedError;exports.usePaymentMode=e.usePaymentMode;exports.useStripeCheckout=e.useStripeCheckout;exports.useSubscription=e.useSubscription;exports.useSubscriptionManagement=e.useSubscriptionManagement;exports.useTranslation=e.useTranslation;exports.validateSecurity=e.validateSecurity;exports.ComplianceGatePage=N.ComplianceGatePage;exports.CreditsBalance=N.CreditsBalance;exports.ecommerce=N.index;exports.useComplianceCheck=N.useComplianceCheck;exports.useCreditsBalance=N.useCreditsBalance;exports.CIRCUIT_BREAKER_PRESETS=i.CIRCUIT_BREAKER_PRESETS;exports.CedrosProvider=i.CedrosProvider;exports.CircuitBreakerOpenError=i.CircuitBreakerOpenError;exports.CircuitState=i.CircuitState;exports.ERROR_CATEGORIES=i.ERROR_CATEGORIES;exports.FEATURE_FLAG_NAMES=i.FEATURE_FLAG_NAMES;exports.FEATURE_FLAG_REGISTRY=i.FEATURE_FLAG_REGISTRY;exports.RATE_LIMITER_PRESETS=i.RATE_LIMITER_PRESETS;exports.RETRY_PRESETS=i.RETRY_PRESETS;exports.createCircuitBreaker=i.createCircuitBreaker;exports.createRateLimiter=i.createRateLimiter;exports.getFeatureFlagDefinition=i.getFeatureFlagDefinition;exports.getFeatureFlagDefinitions=i.getFeatureFlagDefinitions;exports.isFeatureEnabled=i.isFeatureEnabled;exports.parseFeatureFlagBoolean=i.parseFeatureFlagBoolean;exports.resolveFeatureFlags=i.resolveFeatureFlags;exports.retryWithBackoff=i.retryWithBackoff;exports.useCedrosContext=i.useCedrosContext;exports.useCedrosTheme=i.useCedrosTheme;exports.validateConfig=i.validateConfig;exports.LogLevel=f.LogLevel;exports.Logger=f.Logger;exports.createLogger=f.createLogger;exports.getLogger=f.getLogger;exports.CryptoButton=ue.CryptoButton;exports.useX402Payment=ue.useX402Payment;exports.WalletPool=de.WalletPool;exports.createWalletPool=de.createWalletPool;exports.KNOWN_STABLECOINS=ge.KNOWN_STABLECOINS;exports.validateTokenMint=ge.validateTokenMint;exports.CEDROS_PAY_GROUPS=U.CEDROS_PAY_GROUPS;exports.CEDROS_PAY_SECTIONS=U.CEDROS_PAY_SECTIONS;exports.CEDROS_PAY_SECTION_IDS=U.CEDROS_PAY_SECTION_IDS;exports.cedrosPayPlugin=U.cedrosPayPlugin;exports.CryptoSubscribeButton=xe;exports.useCryptoSubscription=pe;exports.useRefundVerification=Te;
@@ -13,7 +13,7 @@ import { WalletReadyState as ge } from "@solana/wallet-adapter-base";
13
13
  import { WalletIcon as Me } from "@solana/wallet-adapter-react-ui";
14
14
  import { WalletPool as ur, createWalletPool as dr } from "./walletPool-9MylB2QK.mjs";
15
15
  import { K as fr, a as mr } from "./tokenMintValidator-DAjQld0r.mjs";
16
- import { C as gr, a as br, b as Sr, c as wr } from "./plugin-BIkt3boU.mjs";
16
+ import { C as gr, a as br, b as Sr, c as wr } from "./plugin-CuoGEYWr.mjs";
17
17
  function Le() {
18
18
  const { subscriptionManager: r, x402Manager: c, walletManager: f } = H(), { publicKey: i, signTransaction: R } = J(), [S, p] = B({
19
19
  status: "idle",
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./styles-BwaDljnz.js"),r=require("./index-DVxx_62C.js"),t=require("./CedrosContext-3Dz7_9Ct.js"),a=require("./fetchWithTimeout-CG0EKbhf.js"),o=require("./plugin-Dw8_Q8rE.js");exports.CEDROS_EVENTS=e.CEDROS_EVENTS;exports.CSP_PRESETS=e.CSP_PRESETS;exports.CedrosPay=e.CedrosPay;exports.CreditsButton=e.CreditsButton;exports.CreditsSubscribeButton=e.CreditsSubscribeButton;exports.PaymentMethodBadge=e.PaymentMethodBadge;exports.PaymentModal=e.PaymentModal;exports.ProductPrice=e.ProductPrice;exports.PurchaseButton=e.PurchaseButton;exports.RPC_PROVIDERS=e.RPC_PROVIDERS;exports.SECURITY_RECOMMENDATIONS=e.SECURITY_RECOMMENDATIONS;exports.StripeButton=e.StripeButton;exports.SubscribeButton=e.SubscribeButton;exports.SubscriptionManagementPanel=e.SubscriptionManagementPanel;exports.calculateDiscountPercentage=e.calculateDiscountPercentage;exports.createTranslator=e.createTranslator;exports.detectLocale=e.detectLocale;exports.emitPaymentError=e.emitPaymentError;exports.emitPaymentProcessing=e.emitPaymentProcessing;exports.emitPaymentStart=e.emitPaymentStart;exports.emitPaymentSuccess=e.emitPaymentSuccess;exports.emitWalletConnect=e.emitWalletConnect;exports.emitWalletConnected=e.emitWalletConnected;exports.emitWalletError=e.emitWalletError;exports.formatCSP=e.formatCSP;exports.formatCouponCodes=e.formatCouponCodes;exports.generateCSP=e.generateCSP;exports.generateCSPDirectives=e.generateCSPDirectives;exports.getAvailableLocales=e.getAvailableLocales;exports.getLocalizedError=e.getLocalizedError;exports.getUserErrorMessage=e.getUserErrorMessage;exports.isRetryableError=e.isRetryableError;exports.loadLocale=e.loadLocale;exports.logSecurityReport=e.logSecurityReport;exports.parseCouponCodes=e.parseCouponCodes;exports.stackCheckoutCoupons=e.stackCheckoutCoupons;exports.useCreditsPayment=e.useCreditsPayment;exports.useCreditsSubscription=e.useCreditsSubscription;exports.useLocalizedError=e.useLocalizedError;exports.usePaymentMode=e.usePaymentMode;exports.useStripeCheckout=e.useStripeCheckout;exports.useSubscription=e.useSubscription;exports.useSubscriptionManagement=e.useSubscriptionManagement;exports.useTranslation=e.useTranslation;exports.validateSecurity=e.validateSecurity;exports.ComplianceGatePage=r.ComplianceGatePage;exports.CreditsBalance=r.CreditsBalance;exports.ecommerce=r.index;exports.useComplianceCheck=r.useComplianceCheck;exports.useCreditsBalance=r.useCreditsBalance;exports.CIRCUIT_BREAKER_PRESETS=t.CIRCUIT_BREAKER_PRESETS;exports.CedrosProvider=t.CedrosProvider;exports.CircuitBreakerOpenError=t.CircuitBreakerOpenError;exports.CircuitState=t.CircuitState;exports.ERROR_CATEGORIES=t.ERROR_CATEGORIES;exports.FEATURE_FLAG_NAMES=t.FEATURE_FLAG_NAMES;exports.FEATURE_FLAG_REGISTRY=t.FEATURE_FLAG_REGISTRY;exports.RATE_LIMITER_PRESETS=t.RATE_LIMITER_PRESETS;exports.RETRY_PRESETS=t.RETRY_PRESETS;exports.createCircuitBreaker=t.createCircuitBreaker;exports.createRateLimiter=t.createRateLimiter;exports.getFeatureFlagDefinition=t.getFeatureFlagDefinition;exports.getFeatureFlagDefinitions=t.getFeatureFlagDefinitions;exports.isFeatureEnabled=t.isFeatureEnabled;exports.parseFeatureFlagBoolean=t.parseFeatureFlagBoolean;exports.resolveFeatureFlags=t.resolveFeatureFlags;exports.retryWithBackoff=t.retryWithBackoff;exports.useCedrosContext=t.useCedrosContext;exports.useCedrosTheme=t.useCedrosTheme;exports.validateConfig=t.validateConfig;exports.LogLevel=a.LogLevel;exports.Logger=a.Logger;exports.createLogger=a.createLogger;exports.getLogger=a.getLogger;exports.CEDROS_PAY_GROUPS=o.CEDROS_PAY_GROUPS;exports.CEDROS_PAY_SECTIONS=o.CEDROS_PAY_SECTIONS;exports.CEDROS_PAY_SECTION_IDS=o.CEDROS_PAY_SECTION_IDS;exports.cedrosPayPlugin=o.cedrosPayPlugin;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./styles-BwaDljnz.js"),r=require("./index-DVxx_62C.js"),t=require("./CedrosContext-3Dz7_9Ct.js"),a=require("./fetchWithTimeout-CG0EKbhf.js"),o=require("./plugin-DNhaPAbC.js");exports.CEDROS_EVENTS=e.CEDROS_EVENTS;exports.CSP_PRESETS=e.CSP_PRESETS;exports.CedrosPay=e.CedrosPay;exports.CreditsButton=e.CreditsButton;exports.CreditsSubscribeButton=e.CreditsSubscribeButton;exports.PaymentMethodBadge=e.PaymentMethodBadge;exports.PaymentModal=e.PaymentModal;exports.ProductPrice=e.ProductPrice;exports.PurchaseButton=e.PurchaseButton;exports.RPC_PROVIDERS=e.RPC_PROVIDERS;exports.SECURITY_RECOMMENDATIONS=e.SECURITY_RECOMMENDATIONS;exports.StripeButton=e.StripeButton;exports.SubscribeButton=e.SubscribeButton;exports.SubscriptionManagementPanel=e.SubscriptionManagementPanel;exports.calculateDiscountPercentage=e.calculateDiscountPercentage;exports.createTranslator=e.createTranslator;exports.detectLocale=e.detectLocale;exports.emitPaymentError=e.emitPaymentError;exports.emitPaymentProcessing=e.emitPaymentProcessing;exports.emitPaymentStart=e.emitPaymentStart;exports.emitPaymentSuccess=e.emitPaymentSuccess;exports.emitWalletConnect=e.emitWalletConnect;exports.emitWalletConnected=e.emitWalletConnected;exports.emitWalletError=e.emitWalletError;exports.formatCSP=e.formatCSP;exports.formatCouponCodes=e.formatCouponCodes;exports.generateCSP=e.generateCSP;exports.generateCSPDirectives=e.generateCSPDirectives;exports.getAvailableLocales=e.getAvailableLocales;exports.getLocalizedError=e.getLocalizedError;exports.getUserErrorMessage=e.getUserErrorMessage;exports.isRetryableError=e.isRetryableError;exports.loadLocale=e.loadLocale;exports.logSecurityReport=e.logSecurityReport;exports.parseCouponCodes=e.parseCouponCodes;exports.stackCheckoutCoupons=e.stackCheckoutCoupons;exports.useCreditsPayment=e.useCreditsPayment;exports.useCreditsSubscription=e.useCreditsSubscription;exports.useLocalizedError=e.useLocalizedError;exports.usePaymentMode=e.usePaymentMode;exports.useStripeCheckout=e.useStripeCheckout;exports.useSubscription=e.useSubscription;exports.useSubscriptionManagement=e.useSubscriptionManagement;exports.useTranslation=e.useTranslation;exports.validateSecurity=e.validateSecurity;exports.ComplianceGatePage=r.ComplianceGatePage;exports.CreditsBalance=r.CreditsBalance;exports.ecommerce=r.index;exports.useComplianceCheck=r.useComplianceCheck;exports.useCreditsBalance=r.useCreditsBalance;exports.CIRCUIT_BREAKER_PRESETS=t.CIRCUIT_BREAKER_PRESETS;exports.CedrosProvider=t.CedrosProvider;exports.CircuitBreakerOpenError=t.CircuitBreakerOpenError;exports.CircuitState=t.CircuitState;exports.ERROR_CATEGORIES=t.ERROR_CATEGORIES;exports.FEATURE_FLAG_NAMES=t.FEATURE_FLAG_NAMES;exports.FEATURE_FLAG_REGISTRY=t.FEATURE_FLAG_REGISTRY;exports.RATE_LIMITER_PRESETS=t.RATE_LIMITER_PRESETS;exports.RETRY_PRESETS=t.RETRY_PRESETS;exports.createCircuitBreaker=t.createCircuitBreaker;exports.createRateLimiter=t.createRateLimiter;exports.getFeatureFlagDefinition=t.getFeatureFlagDefinition;exports.getFeatureFlagDefinitions=t.getFeatureFlagDefinitions;exports.isFeatureEnabled=t.isFeatureEnabled;exports.parseFeatureFlagBoolean=t.parseFeatureFlagBoolean;exports.resolveFeatureFlags=t.resolveFeatureFlags;exports.retryWithBackoff=t.retryWithBackoff;exports.useCedrosContext=t.useCedrosContext;exports.useCedrosTheme=t.useCedrosTheme;exports.validateConfig=t.validateConfig;exports.LogLevel=a.LogLevel;exports.Logger=a.Logger;exports.createLogger=a.createLogger;exports.getLogger=a.getLogger;exports.CEDROS_PAY_GROUPS=o.CEDROS_PAY_GROUPS;exports.CEDROS_PAY_SECTIONS=o.CEDROS_PAY_SECTIONS;exports.CEDROS_PAY_SECTION_IDS=o.CEDROS_PAY_SECTION_IDS;exports.cedrosPayPlugin=o.cedrosPayPlugin;
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { C as s, a as t, b as r, c as o, d as i, P as n, e as c, f as u, g as C,
2
2
  import { C as H, a as J, i as Q, u as X, b as Z } from "./index-CU6M10Rs.mjs";
3
3
  import { C as aa, a as ea, b as sa, c as ta, E as ra, F as oa, d as ia, R as na, e as ca, f as ua, g as Ca, h as Ea, i as Sa, j as la, p as Pa, r as Ra, k as ga, u as ma, l as da, v as pa } from "./CedrosContext-DQc_k5PG.mjs";
4
4
  import { L as Ta, a as La, c as ba, g as ya } from "./fetchWithTimeout-DmMOwL0Q.mjs";
5
- import { C as fa, a as Aa, b as Ba, c as Oa } from "./plugin-BIkt3boU.mjs";
5
+ import { C as fa, a as Aa, b as Ba, c as Oa } from "./plugin-CuoGEYWr.mjs";
6
6
  export {
7
7
  s as CEDROS_EVENTS,
8
8
  fa as CEDROS_PAY_GROUPS,
@@ -281,29 +281,29 @@ const i = {
281
281
  defaultCollapsed: e.defaultCollapsed
282
282
  })),
283
283
  components: {
284
- products: r(() => import("./sections-DcUfZQNE.mjs").then((e) => ({ default: e.ProductsSection }))),
285
- subscriptions: r(() => import("./SubscriptionsSection-lMVHdV5X.mjs").then((e) => ({ default: e.SubscriptionsSection }))),
286
- transactions: r(() => import("./sections-DcUfZQNE.mjs").then((e) => ({ default: e.TransactionsSection }))),
287
- orders: r(() => import("./OrdersSection-vYNuVF5X.mjs").then((e) => ({ default: e.OrdersSection }))),
288
- coupons: r(() => import("./sections-DcUfZQNE.mjs").then((e) => ({ default: e.CouponsSection }))),
289
- refunds: r(() => import("./sections-DcUfZQNE.mjs").then((e) => ({ default: e.RefundsSection }))),
290
- compliance: r(() => import("./ComplianceSection-C61_Hf-X.mjs").then((e) => ({ default: e.ComplianceSection }))),
291
- "chat-logs": r(() => import("./ChatLogsSection-DR7mpuQS.mjs").then((e) => ({ default: e.ChatLogsSection }))),
292
- customers: r(() => import("./CustomersSection-CWWvusxs.mjs").then((e) => ({ default: e.CustomersSection }))),
293
- disputes: r(() => import("./DisputesSection-D8rcS5Vs.mjs").then((e) => ({ default: e.DisputesSection }))),
294
- returns: r(() => import("./ReturnsSection-CRzhXKtI.mjs").then((e) => ({ default: e.ReturnsSection }))),
295
- images: r(() => import("./ImagesSection-Bn9GrRRa.mjs").then((e) => ({ default: e.ImagesSection }))),
296
- inventory: r(() => import("./InventorySection-Dytfmtn8.mjs").then((e) => ({ default: e.InventorySection }))),
297
- storefront: r(() => import("./StorefrontSection-DIYDmj59.mjs").then((e) => ({ default: e.StorefrontSection }))),
298
- "ai-settings": r(() => import("./AISettingsSection-DXWDF4Cf.mjs").then((e) => ({ default: e.AISettingsSection }))),
299
- faqs: r(() => import("./FAQSection-Dck0NM-A.mjs").then((e) => ({ default: e.FAQSection }))),
300
- "payment-settings": r(() => import("./PaymentSettingsSection-BqdGrXen.mjs").then((e) => ({ default: e.PaymentSettingsSection }))),
301
- token22: r(() => import("./Token22Section-Dos0CYEk.mjs").then((e) => ({ default: e.Token22Section }))),
302
- messaging: r(() => import("./MessagingSection-CHFbSxJL.mjs").then((e) => ({ default: e.MessagingSection }))),
303
- webhooks: r(() => import("./WebhooksSection-5gqXzIhq.mjs").then((e) => ({ default: e.WebhooksSection }))),
304
- shipping: r(() => import("./ShippingSection-CbNzGyCP.mjs").then((e) => ({ default: e.ShippingSection }))),
305
- tax: r(() => import("./TaxSection-dD7PzQvG.mjs").then((e) => ({ default: e.TaxSection }))),
306
- settings: r(() => import("./SettingsSection-6o3d8DrH.mjs").then((e) => ({ default: e.SettingsSection })))
284
+ products: r(() => import("./sections-vLd_ind5.mjs").then((e) => ({ default: e.ProductsSection }))),
285
+ subscriptions: r(() => import("./SubscriptionsSection-CNHPCync.mjs").then((e) => ({ default: e.SubscriptionsSection }))),
286
+ transactions: r(() => import("./sections-vLd_ind5.mjs").then((e) => ({ default: e.TransactionsSection }))),
287
+ orders: r(() => import("./OrdersSection-kJzPO6CP.mjs").then((e) => ({ default: e.OrdersSection }))),
288
+ coupons: r(() => import("./sections-vLd_ind5.mjs").then((e) => ({ default: e.CouponsSection }))),
289
+ refunds: r(() => import("./sections-vLd_ind5.mjs").then((e) => ({ default: e.RefundsSection }))),
290
+ compliance: r(() => import("./ComplianceSection-A1hgI_X2.mjs").then((e) => ({ default: e.ComplianceSection }))),
291
+ "chat-logs": r(() => import("./ChatLogsSection-D8FX7Dmn.mjs").then((e) => ({ default: e.ChatLogsSection }))),
292
+ customers: r(() => import("./CustomersSection-BuSVgS16.mjs").then((e) => ({ default: e.CustomersSection }))),
293
+ disputes: r(() => import("./DisputesSection-DqWrBCyC.mjs").then((e) => ({ default: e.DisputesSection }))),
294
+ returns: r(() => import("./ReturnsSection-BcwsQbrU.mjs").then((e) => ({ default: e.ReturnsSection }))),
295
+ images: r(() => import("./ImagesSection-CMvHgbtL.mjs").then((e) => ({ default: e.ImagesSection }))),
296
+ inventory: r(() => import("./InventorySection-5PEOXciZ.mjs").then((e) => ({ default: e.InventorySection }))),
297
+ storefront: r(() => import("./StorefrontSection-DW0q9GsC.mjs").then((e) => ({ default: e.StorefrontSection }))),
298
+ "ai-settings": r(() => import("./AISettingsSection-ChBtZVz7.mjs").then((e) => ({ default: e.AISettingsSection }))),
299
+ faqs: r(() => import("./FAQSection-x0ya8PvI.mjs").then((e) => ({ default: e.FAQSection }))),
300
+ "payment-settings": r(() => import("./PaymentSettingsSection-s_XMFPik.mjs").then((e) => ({ default: e.PaymentSettingsSection }))),
301
+ token22: r(() => import("./Token22Section-DyNDKGdU.mjs").then((e) => ({ default: e.Token22Section }))),
302
+ messaging: r(() => import("./MessagingSection-Bt84iW-5.mjs").then((e) => ({ default: e.MessagingSection }))),
303
+ webhooks: r(() => import("./WebhooksSection-bDVQE9Qp.mjs").then((e) => ({ default: e.WebhooksSection }))),
304
+ shipping: r(() => import("./ShippingSection-B2GtSEvn.mjs").then((e) => ({ default: e.ShippingSection }))),
305
+ tax: r(() => import("./TaxSection-BwLpiery.mjs").then((e) => ({ default: e.TaxSection }))),
306
+ settings: r(() => import("./SettingsSection-OI1G3b40.mjs").then((e) => ({ default: e.SettingsSection })))
307
307
  },
308
308
  createPluginContext(e) {
309
309
  const n = m(
@@ -1 +1 @@
1
- "use strict";const r=require("react/jsx-runtime"),k=require("react"),S=require("./index-WcOlBYZJ.js"),p=require("./fetchWithTimeout-CG0EKbhf.js"),t={adminProfile:"admin-profile",adminSectionAccess:"admin-section-access",cedrosLogin:"cedros-login",cedrosPay:"cedros-pay",org:"org",dashboardPermissions:"dashboard-permissions"};function x(e={}){return{...e}}function T(e){const o=x(e.services);return!(t.adminProfile in o)&&e.cedrosLogin?.user&&(o[t.adminProfile]={user:e.cedrosLogin.user}),!(t.adminSectionAccess in o)&&e.dashboardPermissions&&(o[t.adminSectionAccess]=e.dashboardPermissions),!(t.cedrosLogin in o)&&e.cedrosLogin&&(o[t.cedrosLogin]=e.cedrosLogin),!(t.cedrosPay in o)&&e.cedrosPay&&(o[t.cedrosPay]=e.cedrosPay),!(t.org in o)&&e.org&&(o[t.org]=e.org),!(t.dashboardPermissions in o)&&e.dashboardPermissions&&(o[t.dashboardPermissions]=e.dashboardPermissions),o}function m(e,o){return P(T(e),o)}function P(e,o){return e[o]}class y{serverUrl;walletSigner=null;jwtToken=null;isAdminUser=!1;constructor(o){this.serverUrl=o}getAuthMethod(){return this.walletSigner?.publicKey&&this.walletSigner.signMessage?"wallet":this.jwtToken&&this.isAdminUser?"cedros-login":"none"}isAuthenticated(){return this.getAuthMethod()!=="none"}setWalletSigner(o){this.walletSigner=o,p.getLogger().debug("[AdminAuthManager] Wallet signer updated:",!!o?.publicKey)}setCedrosLoginAuth(o,i){this.jwtToken=o,this.isAdminUser=i??!1,p.getLogger().debug("[AdminAuthManager] Cedros-login auth updated:",{hasToken:!!o,isAdmin:this.isAdminUser})}async createAuthHeaders(o){const i=this.getAuthMethod();if(i==="wallet")return this.createWalletAuthHeaders(o);if(i==="cedros-login")return this.createJwtAuthHeaders();throw new Error("No admin authentication configured. Connect a wallet or sign in as admin.")}async createWalletAuthHeaders(o){if(!this.walletSigner?.publicKey||!this.walletSigner.signMessage)throw new Error("Wallet not connected or does not support message signing");const i=await this.fetchNonce(o),c=new TextEncoder().encode(i.nonce),a=await this.walletSigner.signMessage(c),d=S.bs58.encode(this.walletSigner.publicKey.toBytes()),h=p.gBase64.fromUint8Array(a);return{"X-Signer":d,"X-Message":i.nonce,"X-Signature":h}}createJwtAuthHeaders(){if(!this.jwtToken)throw new Error("No JWT token available");return{Authorization:`Bearer ${this.jwtToken}`}}async fetchNonce(o){const i=`${this.serverUrl}/paywall/v1/nonce`,c=typeof o=="string"?{purpose:o}:{path:o.path,method:o.method.toUpperCase()};p.getLogger().debug("[AdminAuthManager] Fetching nonce:",c);const a=await p.fetchWithTimeout(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!a.ok){const d=await a.text();throw new Error(`Failed to fetch nonce: ${a.status} ${d}`)}return await a.json()}async fetchWithAuth(o,i={}){if(this.getAuthMethod()==="none")throw new Error("No admin authentication configured");const a=(i.method||"GET").toUpperCase(),d=await this.createAuthHeaders({path:o,method:a}),h={...a!=="GET"&&a!=="HEAD"?{"Content-Type":"application/json"}:{},...i.headers||{},...d},u=await p.fetchWithTimeout(`${this.serverUrl}${o}`,{...i,headers:h});if(!u.ok){let g=`Admin API error ${u.status}`;try{const l=await u.json();l&&typeof l.error=="string"?g=l.error:l&&typeof l.message=="string"&&(g=l.message)}catch{}throw new Error(g)}return await u.json()}}function E(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M20 7.5v9l-4 2.25M4 7.5v9l4 2.25"}),r.jsx("path",{d:"m20 7.5-8-4.5-8 4.5"}),r.jsx("path",{d:"m12 12 8-4.5M12 12v9.5M12 12 4 7.5"})]})}function L(){return r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})})}function b(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"}),r.jsx("path",{d:"M13 5v2M13 17v2M13 11v2"})]})}function q(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),r.jsx("path",{d:"M3 3v5h5"}),r.jsx("path",{d:"M12 7v5l4 2"})]})}function j(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),r.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function M(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}),r.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]})}const s={products:()=>r.jsx(E,{}),transactions:()=>r.jsx(L,{}),coupons:()=>r.jsx(b,{}),refunds:()=>r.jsx(q,{}),settings:()=>r.jsx(j,{}),wallet:()=>r.jsx(M,{})},C={settings:r.jsx(j,{}),chevronRight:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m9 18 6-6-6-6"})}),loading:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"cedros-admin__spinner",children:r.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),refresh:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),r.jsx("path",{d:"M21 3v5h-5"}),r.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),r.jsx("path",{d:"M8 16H3v5"})]}),check:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M20 6 9 17l-5-5"})}),trash:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})}),plus:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M12 5v14M5 12h14"})}),chevronDown:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m6 9 6 6 6-6"})}),chevronUp:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m18 15-6-6-6 6"})}),arrowUp:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"m5 12 7-7 7 7"}),r.jsx("path",{d:"M12 19V5"})]}),arrowDown:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"m5 12 7 7 7-7"}),r.jsx("path",{d:"M12 5v14"})]}),delete:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"}),r.jsx("path",{d:"M10 11v6M14 11v6"})]}),close:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),edit:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),r.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),chat:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m3 21 1.9-5.7a8.5 8.5 0 1 1 3.8 3.8z"})}),globe:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),r.jsx("path",{d:"M2 12h20"})]}),eye:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),r.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),eyeOff:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24"}),r.jsx("path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),r.jsx("path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),r.jsx("line",{x1:"2",x2:"22",y1:"2",y2:"22"})]})},f=[{id:"transactions",qualifiedId:"cedros-pay:transactions",label:"Transactions",group:"Store",order:0,endpoints:["GET /admin/transactions"]},{id:"orders",qualifiedId:"cedros-pay:orders",label:"Orders",group:"Store",order:1,endpoints:["GET /admin/orders","GET /admin/orders/{id}"]},{id:"products",qualifiedId:"cedros-pay:products",label:"Products",group:"Store",order:2,endpoints:["GET /admin/products","POST /admin/products","PUT /admin/products/{id}","DELETE /admin/products/{id}"]},{id:"subscriptions",qualifiedId:"cedros-pay:subscriptions",label:"Subscriptions",group:"Store",order:3,endpoints:["GET /admin/subscriptions","POST /admin/subscriptions","PUT /admin/subscriptions/{id}"]},{id:"coupons",qualifiedId:"cedros-pay:coupons",label:"Coupons",group:"Store",order:4,endpoints:["GET /admin/coupons","POST /admin/coupons","PUT /admin/coupons/{id}","DELETE /admin/coupons/{id}"]},{id:"refunds",qualifiedId:"cedros-pay:refunds",label:"Refunds",group:"Store",order:5,endpoints:["GET /admin/refunds","POST /admin/refunds/{id}/approve","POST /admin/refunds/{id}/deny"]},{id:"compliance",qualifiedId:"cedros-pay:compliance",label:"Compliance",group:"Store",order:6,endpoints:["GET /admin/compliance/stats","POST /admin/compliance/check"]},{id:"chat-logs",qualifiedId:"cedros-pay:chat-logs",label:"Chat Logs",group:"Store",order:7,endpoints:["GET /admin/chats","GET /admin/chats/{sessionId}"]},{id:"customers",qualifiedId:"cedros-pay:customers",label:"Customers",group:"Store",order:8,endpoints:["GET /admin/customers","POST /admin/customers","PUT /admin/customers/{id}"]},{id:"disputes",qualifiedId:"cedros-pay:disputes",label:"Disputes",group:"Store",order:9,endpoints:["GET /admin/disputes","GET /admin/disputes/{id}","PUT /admin/disputes/{id}/status"]},{id:"returns",qualifiedId:"cedros-pay:returns",label:"Returns",group:"Store",order:10,endpoints:["GET /admin/returns","GET /admin/returns/{id}","PUT /admin/returns/{id}/status"]},{id:"images",qualifiedId:"cedros-pay:images",label:"Images",group:"Store",order:11,endpoints:["GET /admin/images","POST /admin/images","DELETE /admin/images/{id}"]},{id:"inventory",qualifiedId:"cedros-pay:inventory",label:"Inventory",group:"Store",order:12,endpoints:["GET /admin/products","GET /admin/products/{id}/inventory/adjustments"]},{id:"storefront",qualifiedId:"cedros-pay:storefront",label:"Storefront",group:"Configuration",order:20,endpoints:["GET /admin/config/shop","PUT /admin/config/shop"]},{id:"ai-settings",qualifiedId:"cedros-pay:ai-settings",label:"Store AI",group:"Configuration",order:21,endpoints:["GET /admin/config/ai","PUT /admin/config/ai/api-key","PUT /admin/config/ai/assignment","PUT /admin/config/ai/prompt"]},{id:"faqs",qualifiedId:"cedros-pay:faqs",label:"Knowledge Base",group:"Configuration",order:22,endpoints:["GET /admin/faqs","POST /admin/faqs","PUT /admin/faqs/{id}","DELETE /admin/faqs/{id}"]},{id:"payment-settings",qualifiedId:"cedros-pay:payment-settings",label:"Payment Options",group:"Configuration",order:23,endpoints:["GET /admin/config/stripe","PUT /admin/config/stripe","GET /admin/config/x402","PUT /admin/config/x402","GET /admin/config/cedros_login","PUT /admin/config/cedros_login"]},{id:"token22",qualifiedId:"cedros-pay:token22",label:"Gift Cards & Token-22",group:"Configuration",order:24,endpoints:["GET /admin/token22/status","POST /admin/token22/initialize","POST /admin/token22/harvest-fees","GET /admin/gift-card-redemptions"]},{id:"messaging",qualifiedId:"cedros-pay:messaging",label:"Store Messages",group:"Configuration",order:25,endpoints:["GET /admin/config/messaging","PUT /admin/config/messaging"]},{id:"webhooks",qualifiedId:"cedros-pay:webhooks",label:"Webhooks",group:"Configuration",order:26,endpoints:["GET /admin/webhooks","POST /admin/webhooks/{id}/retry","DELETE /admin/webhooks/{id}","GET /admin/webhooks/dlq"]},{id:"shipping",qualifiedId:"cedros-pay:shipping",label:"Shipping",group:"Configuration",order:27,endpoints:["GET /admin/shipping/profiles","POST /admin/shipping/profiles","GET /admin/shipping/profiles/{id}/rates"]},{id:"tax",qualifiedId:"cedros-pay:tax",label:"Tax Rates",group:"Configuration",order:28,endpoints:["GET /admin/tax/rates","POST /admin/tax/rates","PUT /admin/tax/rates/{id}","DELETE /admin/tax/rates/{id}"]},{id:"settings",qualifiedId:"cedros-pay:settings",label:"Store Server",group:"Configuration",order:29,endpoints:["GET /admin/config/server","PUT /admin/config/server"]}],A=f.map(e=>e.qualifiedId),w=[{id:"Store",label:"Store",order:1,defaultCollapsed:!1},{id:"Configuration",label:"Configuration",order:2,defaultCollapsed:!0}],n=e=>k.lazy(async()=>{const c=(await e()).default;return{default:({pluginContext:d})=>{const h=d.getAccessToken(),u=d.hasPermission("cedros-pay:admin")||d.hasPermission("admin"),g=k.useMemo(()=>{const v=new y(d.serverUrl);return v.setCedrosLoginAuth(h??null,u),v},[u,d.serverUrl,h]),l={serverUrl:d.serverUrl,authManager:g};return r.jsx(c,{...l})}}}),I={id:"cedros-pay",name:"Cedros Pay",version:"1.0.0",sections:f.map(e=>({id:e.id,label:e.label,icon:{transactions:s.transactions,orders:s.transactions,products:s.products,subscriptions:s.products,coupons:s.coupons,refunds:s.refunds,compliance:s.settings,"chat-logs":s.settings,customers:s.settings,disputes:s.settings,returns:s.refunds,images:s.products,inventory:s.products,storefront:s.products,"ai-settings":s.settings,faqs:s.settings,"payment-settings":s.wallet,token22:s.wallet,messaging:s.settings,webhooks:s.settings,shipping:s.products,tax:s.transactions,settings:s.settings}[e.id],group:e.group,order:e.order})),groups:w.map(e=>({id:e.id,label:e.label,order:e.order,defaultCollapsed:e.defaultCollapsed})),components:{products:n(()=>Promise.resolve().then(()=>require("./sections-D1d83mfH.js")).then(e=>({default:e.ProductsSection}))),subscriptions:n(()=>Promise.resolve().then(()=>require("./SubscriptionsSection-Bof5MElz.js")).then(e=>({default:e.SubscriptionsSection}))),transactions:n(()=>Promise.resolve().then(()=>require("./sections-D1d83mfH.js")).then(e=>({default:e.TransactionsSection}))),orders:n(()=>Promise.resolve().then(()=>require("./OrdersSection-BuzTs9XG.js")).then(e=>({default:e.OrdersSection}))),coupons:n(()=>Promise.resolve().then(()=>require("./sections-D1d83mfH.js")).then(e=>({default:e.CouponsSection}))),refunds:n(()=>Promise.resolve().then(()=>require("./sections-D1d83mfH.js")).then(e=>({default:e.RefundsSection}))),compliance:n(()=>Promise.resolve().then(()=>require("./ComplianceSection-DS4e2IBp.js")).then(e=>({default:e.ComplianceSection}))),"chat-logs":n(()=>Promise.resolve().then(()=>require("./ChatLogsSection-CH37u0nX.js")).then(e=>({default:e.ChatLogsSection}))),customers:n(()=>Promise.resolve().then(()=>require("./CustomersSection-Bzs9Qon3.js")).then(e=>({default:e.CustomersSection}))),disputes:n(()=>Promise.resolve().then(()=>require("./DisputesSection-ClcYIHga.js")).then(e=>({default:e.DisputesSection}))),returns:n(()=>Promise.resolve().then(()=>require("./ReturnsSection-i5W_3so1.js")).then(e=>({default:e.ReturnsSection}))),images:n(()=>Promise.resolve().then(()=>require("./ImagesSection-CSwBHvNl.js")).then(e=>({default:e.ImagesSection}))),inventory:n(()=>Promise.resolve().then(()=>require("./InventorySection-ymxaMcIg.js")).then(e=>({default:e.InventorySection}))),storefront:n(()=>Promise.resolve().then(()=>require("./StorefrontSection-CZZj5he9.js")).then(e=>({default:e.StorefrontSection}))),"ai-settings":n(()=>Promise.resolve().then(()=>require("./AISettingsSection-B12x5sV5.js")).then(e=>({default:e.AISettingsSection}))),faqs:n(()=>Promise.resolve().then(()=>require("./FAQSection-0UnN2BZs.js")).then(e=>({default:e.FAQSection}))),"payment-settings":n(()=>Promise.resolve().then(()=>require("./PaymentSettingsSection-BOaW8lLv.js")).then(e=>({default:e.PaymentSettingsSection}))),token22:n(()=>Promise.resolve().then(()=>require("./Token22Section-Di5fHsrU.js")).then(e=>({default:e.Token22Section}))),messaging:n(()=>Promise.resolve().then(()=>require("./MessagingSection-Dtfv0DvU.js")).then(e=>({default:e.MessagingSection}))),webhooks:n(()=>Promise.resolve().then(()=>require("./WebhooksSection-CiLDyl7c.js")).then(e=>({default:e.WebhooksSection}))),shipping:n(()=>Promise.resolve().then(()=>require("./ShippingSection-BUzPW1AG.js")).then(e=>({default:e.ShippingSection}))),tax:n(()=>Promise.resolve().then(()=>require("./TaxSection-Be-9v60Z.js")).then(e=>({default:e.TaxSection}))),settings:n(()=>Promise.resolve().then(()=>require("./SettingsSection-CIhO51Zj.js")).then(e=>({default:e.SettingsSection})))},createPluginContext(e){const o=m(e,t.cedrosPay),i=m(e,t.cedrosLogin),c=m(e,t.org);return{serverUrl:o?.serverUrl||i?.serverUrl||"",userId:i?.user?.id,getAccessToken:()=>i?.getAccessToken?.()||o?.jwtToken||null,hasPermission:d=>this.checkPermission(d,e),orgId:c?.orgId,pluginData:{walletAddress:o?.walletAddress}}},checkPermission(e,o){const i=m(o,t.org);return i?.permissions?i.permissions.includes(e):!1},cssNamespace:"cedros-dashboard"};exports.CEDROS_PAY_GROUPS=w;exports.CEDROS_PAY_SECTIONS=f;exports.CEDROS_PAY_SECTION_IDS=A;exports.Icons=C;exports.cedrosPayPlugin=I;
1
+ "use strict";const r=require("react/jsx-runtime"),k=require("react"),S=require("./index-WcOlBYZJ.js"),p=require("./fetchWithTimeout-CG0EKbhf.js"),t={adminProfile:"admin-profile",adminSectionAccess:"admin-section-access",cedrosLogin:"cedros-login",cedrosPay:"cedros-pay",org:"org",dashboardPermissions:"dashboard-permissions"};function x(e={}){return{...e}}function T(e){const o=x(e.services);return!(t.adminProfile in o)&&e.cedrosLogin?.user&&(o[t.adminProfile]={user:e.cedrosLogin.user}),!(t.adminSectionAccess in o)&&e.dashboardPermissions&&(o[t.adminSectionAccess]=e.dashboardPermissions),!(t.cedrosLogin in o)&&e.cedrosLogin&&(o[t.cedrosLogin]=e.cedrosLogin),!(t.cedrosPay in o)&&e.cedrosPay&&(o[t.cedrosPay]=e.cedrosPay),!(t.org in o)&&e.org&&(o[t.org]=e.org),!(t.dashboardPermissions in o)&&e.dashboardPermissions&&(o[t.dashboardPermissions]=e.dashboardPermissions),o}function m(e,o){return P(T(e),o)}function P(e,o){return e[o]}class y{serverUrl;walletSigner=null;jwtToken=null;isAdminUser=!1;constructor(o){this.serverUrl=o}getAuthMethod(){return this.walletSigner?.publicKey&&this.walletSigner.signMessage?"wallet":this.jwtToken&&this.isAdminUser?"cedros-login":"none"}isAuthenticated(){return this.getAuthMethod()!=="none"}setWalletSigner(o){this.walletSigner=o,p.getLogger().debug("[AdminAuthManager] Wallet signer updated:",!!o?.publicKey)}setCedrosLoginAuth(o,i){this.jwtToken=o,this.isAdminUser=i??!1,p.getLogger().debug("[AdminAuthManager] Cedros-login auth updated:",{hasToken:!!o,isAdmin:this.isAdminUser})}async createAuthHeaders(o){const i=this.getAuthMethod();if(i==="wallet")return this.createWalletAuthHeaders(o);if(i==="cedros-login")return this.createJwtAuthHeaders();throw new Error("No admin authentication configured. Connect a wallet or sign in as admin.")}async createWalletAuthHeaders(o){if(!this.walletSigner?.publicKey||!this.walletSigner.signMessage)throw new Error("Wallet not connected or does not support message signing");const i=await this.fetchNonce(o),c=new TextEncoder().encode(i.nonce),a=await this.walletSigner.signMessage(c),d=S.bs58.encode(this.walletSigner.publicKey.toBytes()),h=p.gBase64.fromUint8Array(a);return{"X-Signer":d,"X-Message":i.nonce,"X-Signature":h}}createJwtAuthHeaders(){if(!this.jwtToken)throw new Error("No JWT token available");return{Authorization:`Bearer ${this.jwtToken}`}}async fetchNonce(o){const i=`${this.serverUrl}/paywall/v1/nonce`,c=typeof o=="string"?{purpose:o}:{path:o.path,method:o.method.toUpperCase()};p.getLogger().debug("[AdminAuthManager] Fetching nonce:",c);const a=await p.fetchWithTimeout(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!a.ok){const d=await a.text();throw new Error(`Failed to fetch nonce: ${a.status} ${d}`)}return await a.json()}async fetchWithAuth(o,i={}){if(this.getAuthMethod()==="none")throw new Error("No admin authentication configured");const a=(i.method||"GET").toUpperCase(),d=await this.createAuthHeaders({path:o,method:a}),h={...a!=="GET"&&a!=="HEAD"?{"Content-Type":"application/json"}:{},...i.headers||{},...d},u=await p.fetchWithTimeout(`${this.serverUrl}${o}`,{...i,headers:h});if(!u.ok){let g=`Admin API error ${u.status}`;try{const l=await u.json();l&&typeof l.error=="string"?g=l.error:l&&typeof l.message=="string"&&(g=l.message)}catch{}throw new Error(g)}return await u.json()}}function E(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M20 7.5v9l-4 2.25M4 7.5v9l4 2.25"}),r.jsx("path",{d:"m20 7.5-8-4.5-8 4.5"}),r.jsx("path",{d:"m12 12 8-4.5M12 12v9.5M12 12 4 7.5"})]})}function L(){return r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})})}function b(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"}),r.jsx("path",{d:"M13 5v2M13 17v2M13 11v2"})]})}function q(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),r.jsx("path",{d:"M3 3v5h5"}),r.jsx("path",{d:"M12 7v5l4 2"})]})}function j(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),r.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function M(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}),r.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]})}const s={products:()=>r.jsx(E,{}),transactions:()=>r.jsx(L,{}),coupons:()=>r.jsx(b,{}),refunds:()=>r.jsx(q,{}),settings:()=>r.jsx(j,{}),wallet:()=>r.jsx(M,{})},C={settings:r.jsx(j,{}),chevronRight:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m9 18 6-6-6-6"})}),loading:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"cedros-admin__spinner",children:r.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),refresh:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),r.jsx("path",{d:"M21 3v5h-5"}),r.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),r.jsx("path",{d:"M8 16H3v5"})]}),check:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M20 6 9 17l-5-5"})}),trash:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})}),plus:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M12 5v14M5 12h14"})}),chevronDown:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m6 9 6 6 6-6"})}),chevronUp:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m18 15-6-6-6 6"})}),arrowUp:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"m5 12 7-7 7 7"}),r.jsx("path",{d:"M12 19V5"})]}),arrowDown:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"m5 12 7 7 7-7"}),r.jsx("path",{d:"M12 5v14"})]}),delete:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"}),r.jsx("path",{d:"M10 11v6M14 11v6"})]}),close:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),edit:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),r.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),chat:r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m3 21 1.9-5.7a8.5 8.5 0 1 1 3.8 3.8z"})}),globe:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),r.jsx("path",{d:"M2 12h20"})]}),eye:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),r.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),eyeOff:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24"}),r.jsx("path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),r.jsx("path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),r.jsx("line",{x1:"2",x2:"22",y1:"2",y2:"22"})]})},f=[{id:"transactions",qualifiedId:"cedros-pay:transactions",label:"Transactions",group:"Store",order:0,endpoints:["GET /admin/transactions"]},{id:"orders",qualifiedId:"cedros-pay:orders",label:"Orders",group:"Store",order:1,endpoints:["GET /admin/orders","GET /admin/orders/{id}"]},{id:"products",qualifiedId:"cedros-pay:products",label:"Products",group:"Store",order:2,endpoints:["GET /admin/products","POST /admin/products","PUT /admin/products/{id}","DELETE /admin/products/{id}"]},{id:"subscriptions",qualifiedId:"cedros-pay:subscriptions",label:"Subscriptions",group:"Store",order:3,endpoints:["GET /admin/subscriptions","POST /admin/subscriptions","PUT /admin/subscriptions/{id}"]},{id:"coupons",qualifiedId:"cedros-pay:coupons",label:"Coupons",group:"Store",order:4,endpoints:["GET /admin/coupons","POST /admin/coupons","PUT /admin/coupons/{id}","DELETE /admin/coupons/{id}"]},{id:"refunds",qualifiedId:"cedros-pay:refunds",label:"Refunds",group:"Store",order:5,endpoints:["GET /admin/refunds","POST /admin/refunds/{id}/approve","POST /admin/refunds/{id}/deny"]},{id:"compliance",qualifiedId:"cedros-pay:compliance",label:"Compliance",group:"Store",order:6,endpoints:["GET /admin/compliance/stats","POST /admin/compliance/check"]},{id:"chat-logs",qualifiedId:"cedros-pay:chat-logs",label:"Chat Logs",group:"Store",order:7,endpoints:["GET /admin/chats","GET /admin/chats/{sessionId}"]},{id:"customers",qualifiedId:"cedros-pay:customers",label:"Customers",group:"Store",order:8,endpoints:["GET /admin/customers","POST /admin/customers","PUT /admin/customers/{id}"]},{id:"disputes",qualifiedId:"cedros-pay:disputes",label:"Disputes",group:"Store",order:9,endpoints:["GET /admin/disputes","GET /admin/disputes/{id}","PUT /admin/disputes/{id}/status"]},{id:"returns",qualifiedId:"cedros-pay:returns",label:"Returns",group:"Store",order:10,endpoints:["GET /admin/returns","GET /admin/returns/{id}","PUT /admin/returns/{id}/status"]},{id:"images",qualifiedId:"cedros-pay:images",label:"Images",group:"Store",order:11,endpoints:["GET /admin/images","POST /admin/images","DELETE /admin/images/{id}"]},{id:"inventory",qualifiedId:"cedros-pay:inventory",label:"Inventory",group:"Store",order:12,endpoints:["GET /admin/products","GET /admin/products/{id}/inventory/adjustments"]},{id:"storefront",qualifiedId:"cedros-pay:storefront",label:"Storefront",group:"Configuration",order:20,endpoints:["GET /admin/config/shop","PUT /admin/config/shop"]},{id:"ai-settings",qualifiedId:"cedros-pay:ai-settings",label:"Store AI",group:"Configuration",order:21,endpoints:["GET /admin/config/ai","PUT /admin/config/ai/api-key","PUT /admin/config/ai/assignment","PUT /admin/config/ai/prompt"]},{id:"faqs",qualifiedId:"cedros-pay:faqs",label:"Knowledge Base",group:"Configuration",order:22,endpoints:["GET /admin/faqs","POST /admin/faqs","PUT /admin/faqs/{id}","DELETE /admin/faqs/{id}"]},{id:"payment-settings",qualifiedId:"cedros-pay:payment-settings",label:"Payment Options",group:"Configuration",order:23,endpoints:["GET /admin/config/stripe","PUT /admin/config/stripe","GET /admin/config/x402","PUT /admin/config/x402","GET /admin/config/cedros_login","PUT /admin/config/cedros_login"]},{id:"token22",qualifiedId:"cedros-pay:token22",label:"Gift Cards & Token-22",group:"Configuration",order:24,endpoints:["GET /admin/token22/status","POST /admin/token22/initialize","POST /admin/token22/harvest-fees","GET /admin/gift-card-redemptions"]},{id:"messaging",qualifiedId:"cedros-pay:messaging",label:"Store Messages",group:"Configuration",order:25,endpoints:["GET /admin/config/messaging","PUT /admin/config/messaging"]},{id:"webhooks",qualifiedId:"cedros-pay:webhooks",label:"Webhooks",group:"Configuration",order:26,endpoints:["GET /admin/webhooks","POST /admin/webhooks/{id}/retry","DELETE /admin/webhooks/{id}","GET /admin/webhooks/dlq"]},{id:"shipping",qualifiedId:"cedros-pay:shipping",label:"Shipping",group:"Configuration",order:27,endpoints:["GET /admin/shipping/profiles","POST /admin/shipping/profiles","GET /admin/shipping/profiles/{id}/rates"]},{id:"tax",qualifiedId:"cedros-pay:tax",label:"Tax Rates",group:"Configuration",order:28,endpoints:["GET /admin/tax/rates","POST /admin/tax/rates","PUT /admin/tax/rates/{id}","DELETE /admin/tax/rates/{id}"]},{id:"settings",qualifiedId:"cedros-pay:settings",label:"Store Server",group:"Configuration",order:29,endpoints:["GET /admin/config/server","PUT /admin/config/server"]}],A=f.map(e=>e.qualifiedId),w=[{id:"Store",label:"Store",order:1,defaultCollapsed:!1},{id:"Configuration",label:"Configuration",order:2,defaultCollapsed:!0}],n=e=>k.lazy(async()=>{const c=(await e()).default;return{default:({pluginContext:d})=>{const h=d.getAccessToken(),u=d.hasPermission("cedros-pay:admin")||d.hasPermission("admin"),g=k.useMemo(()=>{const v=new y(d.serverUrl);return v.setCedrosLoginAuth(h??null,u),v},[u,d.serverUrl,h]),l={serverUrl:d.serverUrl,authManager:g};return r.jsx(c,{...l})}}}),I={id:"cedros-pay",name:"Cedros Pay",version:"1.0.0",sections:f.map(e=>({id:e.id,label:e.label,icon:{transactions:s.transactions,orders:s.transactions,products:s.products,subscriptions:s.products,coupons:s.coupons,refunds:s.refunds,compliance:s.settings,"chat-logs":s.settings,customers:s.settings,disputes:s.settings,returns:s.refunds,images:s.products,inventory:s.products,storefront:s.products,"ai-settings":s.settings,faqs:s.settings,"payment-settings":s.wallet,token22:s.wallet,messaging:s.settings,webhooks:s.settings,shipping:s.products,tax:s.transactions,settings:s.settings}[e.id],group:e.group,order:e.order})),groups:w.map(e=>({id:e.id,label:e.label,order:e.order,defaultCollapsed:e.defaultCollapsed})),components:{products:n(()=>Promise.resolve().then(()=>require("./sections-BYdyCKFF.js")).then(e=>({default:e.ProductsSection}))),subscriptions:n(()=>Promise.resolve().then(()=>require("./SubscriptionsSection-QMoSKKot.js")).then(e=>({default:e.SubscriptionsSection}))),transactions:n(()=>Promise.resolve().then(()=>require("./sections-BYdyCKFF.js")).then(e=>({default:e.TransactionsSection}))),orders:n(()=>Promise.resolve().then(()=>require("./OrdersSection-Bsou3cwl.js")).then(e=>({default:e.OrdersSection}))),coupons:n(()=>Promise.resolve().then(()=>require("./sections-BYdyCKFF.js")).then(e=>({default:e.CouponsSection}))),refunds:n(()=>Promise.resolve().then(()=>require("./sections-BYdyCKFF.js")).then(e=>({default:e.RefundsSection}))),compliance:n(()=>Promise.resolve().then(()=>require("./ComplianceSection-UWfkNrmW.js")).then(e=>({default:e.ComplianceSection}))),"chat-logs":n(()=>Promise.resolve().then(()=>require("./ChatLogsSection-B5AdoZls.js")).then(e=>({default:e.ChatLogsSection}))),customers:n(()=>Promise.resolve().then(()=>require("./CustomersSection-Rh552kcC.js")).then(e=>({default:e.CustomersSection}))),disputes:n(()=>Promise.resolve().then(()=>require("./DisputesSection-BtMdxOuD.js")).then(e=>({default:e.DisputesSection}))),returns:n(()=>Promise.resolve().then(()=>require("./ReturnsSection-BwHv1HkV.js")).then(e=>({default:e.ReturnsSection}))),images:n(()=>Promise.resolve().then(()=>require("./ImagesSection-tRpBN-ls.js")).then(e=>({default:e.ImagesSection}))),inventory:n(()=>Promise.resolve().then(()=>require("./InventorySection-clEVFr_r.js")).then(e=>({default:e.InventorySection}))),storefront:n(()=>Promise.resolve().then(()=>require("./StorefrontSection-BxaWrsPc.js")).then(e=>({default:e.StorefrontSection}))),"ai-settings":n(()=>Promise.resolve().then(()=>require("./AISettingsSection-DSROL7Lg.js")).then(e=>({default:e.AISettingsSection}))),faqs:n(()=>Promise.resolve().then(()=>require("./FAQSection-DczKj0C3.js")).then(e=>({default:e.FAQSection}))),"payment-settings":n(()=>Promise.resolve().then(()=>require("./PaymentSettingsSection-CUgUJ7tm.js")).then(e=>({default:e.PaymentSettingsSection}))),token22:n(()=>Promise.resolve().then(()=>require("./Token22Section-B_URxab9.js")).then(e=>({default:e.Token22Section}))),messaging:n(()=>Promise.resolve().then(()=>require("./MessagingSection-BpwTsNW1.js")).then(e=>({default:e.MessagingSection}))),webhooks:n(()=>Promise.resolve().then(()=>require("./WebhooksSection-BIs2Qh-o.js")).then(e=>({default:e.WebhooksSection}))),shipping:n(()=>Promise.resolve().then(()=>require("./ShippingSection-DyTGH_Fh.js")).then(e=>({default:e.ShippingSection}))),tax:n(()=>Promise.resolve().then(()=>require("./TaxSection-BKhh7kOv.js")).then(e=>({default:e.TaxSection}))),settings:n(()=>Promise.resolve().then(()=>require("./SettingsSection-B_feZEzU.js")).then(e=>({default:e.SettingsSection})))},createPluginContext(e){const o=m(e,t.cedrosPay),i=m(e,t.cedrosLogin),c=m(e,t.org);return{serverUrl:o?.serverUrl||i?.serverUrl||"",userId:i?.user?.id,getAccessToken:()=>i?.getAccessToken?.()||o?.jwtToken||null,hasPermission:d=>this.checkPermission(d,e),orgId:c?.orgId,pluginData:{walletAddress:o?.walletAddress}}},checkPermission(e,o){const i=m(o,t.org);return i?.permissions?i.permissions.includes(e):!1},cssNamespace:"cedros-dashboard"};exports.CEDROS_PAY_GROUPS=w;exports.CEDROS_PAY_SECTIONS=f;exports.CEDROS_PAY_SECTION_IDS=A;exports.Icons=C;exports.cedrosPayPlugin=I;