@cedros/pay-react 1.1.21 → 1.1.23

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 (114) hide show
  1. package/dist/{AISettingsSection-BXWZcMQT.js → AISettingsSection-DAztmwnN.js} +1 -1
  2. package/dist/{AISettingsSection-8eDaxYp8.mjs → AISettingsSection-DpMIk431.mjs} +2 -2
  3. package/dist/{AutosaveIndicator-3S7EvXip.mjs → AutosaveIndicator-BRCqAWqP.mjs} +1 -1
  4. package/dist/{AutosaveIndicator-DW4IPbZ5.js → AutosaveIndicator-BnQkKxzr.js} +1 -1
  5. package/dist/{CedrosContext-D-lnoEkR.js → CedrosContext-7dwmEeUY.js} +2 -2
  6. package/dist/{CedrosContext-BE6P5PQ0.mjs → CedrosContext-BlArEF7k.mjs} +95 -78
  7. package/dist/{CryptoButton-Dy-g3bR0.js → CryptoButton-C1AAOOfj.js} +1 -1
  8. package/dist/{CryptoButton-CksMkZjL.mjs → CryptoButton-CREryx1l.mjs} +2 -2
  9. package/dist/{FAQSection-Dg-I7Z-N.mjs → FAQSection-Ruzs7a-0.mjs} +1 -1
  10. package/dist/{FAQSection-r6eKjfdO.js → FAQSection-yw64HLy3.js} +1 -1
  11. package/dist/{MessagingSection-D39EuOLN.mjs → MessagingSection-BLRjfBQT.mjs} +2 -2
  12. package/dist/{MessagingSection-Cld5Q7ZM.js → MessagingSection-Dp_SaXsv.js} +1 -1
  13. package/dist/OrdersSection-C2dyWqrR.js +1 -0
  14. package/dist/OrdersSection-l-MtP9EN.mjs +233 -0
  15. package/dist/{PaymentSettingsSection-CEGHN6VI.mjs → PaymentSettingsSection-Bbq93UtC.mjs} +1 -1
  16. package/dist/{PaymentSettingsSection-B-MRsh1K.js → PaymentSettingsSection-C5bhLgU7.js} +1 -1
  17. package/dist/{SettingsSection-ZrzfLBlS.js → SettingsSection-D_pKPRrP.js} +1 -1
  18. package/dist/{SettingsSection-CPFOuoZG.mjs → SettingsSection-DorqCFXE.mjs} +1 -1
  19. package/dist/SingleCategorySettings-BAND8Zkw.mjs +1006 -0
  20. package/dist/SingleCategorySettings-Cg-zuJfr.js +3 -0
  21. package/dist/{StorefrontSection-f54ySA6i.mjs → StorefrontSection-FSOxBclu.mjs} +2 -2
  22. package/dist/{StorefrontSection-DGVcJu1T.js → StorefrontSection-QZPEZ6Lz.js} +1 -1
  23. package/dist/{SubscriptionsSection-F2IiU2jv.mjs → SubscriptionsSection-C4TDXCX2.mjs} +1 -1
  24. package/dist/{SubscriptionsSection-fzbL5DGC.js → SubscriptionsSection-DYr99VzB.js} +1 -1
  25. package/dist/Token22Section-Cmn2lKcd.mjs +1685 -0
  26. package/dist/Token22Section-D3nnUyim.js +1 -0
  27. package/dist/{WalletManager-QcfgQmap.js → WalletManager-Bwk3rgr1.js} +1 -1
  28. package/dist/{WalletManager-D78miaJ2.mjs → WalletManager-peBN6RDH.mjs} +1 -1
  29. package/dist/bn-CHdpZHQm.mjs +1185 -0
  30. package/dist/bn-RbgIlcHc.js +1 -0
  31. package/dist/configApi-Ch0Rr7TD.mjs +554 -0
  32. package/dist/configApi-CxEbCAgG.js +1 -0
  33. package/dist/crypto-only.js +1 -1
  34. package/dist/crypto-only.mjs +54 -52
  35. package/dist/{index-bqhsxBTY.mjs → index-CKNB7XsA.mjs} +6709 -5888
  36. package/dist/index-vEe2Y39x.js +84 -0
  37. package/dist/index.js +1 -1
  38. package/dist/index.mjs +34 -32
  39. package/dist/pay-react_false-CPX8Vyp9.mjs +5 -0
  40. package/dist/pay-react_false-DaeIe3_l.js +1 -0
  41. package/dist/{sections-Dh0qFSUW.js → sections-Cklkxd85.js} +1 -1
  42. package/dist/{sections-CiAMjlPd.mjs → sections-Dt6vxDU4.mjs} +1 -1
  43. package/dist/src/components/CreditsBalance.d.ts +24 -0
  44. package/dist/src/components/CreditsBalance.d.ts.map +1 -0
  45. package/dist/src/components/admin/AssetClassesTab.d.ts +20 -0
  46. package/dist/src/components/admin/AssetClassesTab.d.ts.map +1 -0
  47. package/dist/src/components/admin/AssetRedemptionManager.d.ts +21 -0
  48. package/dist/src/components/admin/AssetRedemptionManager.d.ts.map +1 -0
  49. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts +1 -1
  50. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts.map +1 -1
  51. package/dist/src/components/admin/GiftCardComplianceTab.d.ts +3 -0
  52. package/dist/src/components/admin/GiftCardComplianceTab.d.ts.map +1 -0
  53. package/dist/src/components/admin/LiquidityPoolTab.d.ts +11 -0
  54. package/dist/src/components/admin/LiquidityPoolTab.d.ts.map +1 -0
  55. package/dist/src/components/admin/OrdersSection.d.ts +3 -0
  56. package/dist/src/components/admin/OrdersSection.d.ts.map +1 -0
  57. package/dist/src/components/admin/ProductsSection.d.ts.map +1 -1
  58. package/dist/src/components/admin/RedemptionFormBuilder.d.ts +25 -0
  59. package/dist/src/components/admin/RedemptionFormBuilder.d.ts.map +1 -0
  60. package/dist/src/components/admin/Token22Section.d.ts +3 -0
  61. package/dist/src/components/admin/Token22Section.d.ts.map +1 -0
  62. package/dist/src/components/admin/configApi.d.ts.map +1 -1
  63. package/dist/src/components/admin/index.d.ts +3 -0
  64. package/dist/src/components/admin/index.d.ts.map +1 -1
  65. package/dist/src/ecommerce/adapters/mock/mockAdapter.d.ts.map +1 -1
  66. package/dist/src/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -1
  67. package/dist/src/ecommerce/components/catalog/AssetBadge.d.ts +13 -0
  68. package/dist/src/ecommerce/components/catalog/AssetBadge.d.ts.map +1 -0
  69. package/dist/src/ecommerce/components/catalog/ProductCard.d.ts.map +1 -1
  70. package/dist/src/ecommerce/components/checkout/CheckoutForm.d.ts.map +1 -1
  71. package/dist/src/ecommerce/components/checkout/CheckoutReceipt.d.ts +9 -2
  72. package/dist/src/ecommerce/components/checkout/CheckoutReceipt.d.ts.map +1 -1
  73. package/dist/src/ecommerce/components/checkout/CheckoutSuccessPage.d.ts +7 -1
  74. package/dist/src/ecommerce/components/checkout/CheckoutSuccessPage.d.ts.map +1 -1
  75. package/dist/src/ecommerce/components/checkout/RedemptionForm.d.ts +22 -0
  76. package/dist/src/ecommerce/components/checkout/RedemptionForm.d.ts.map +1 -0
  77. package/dist/src/ecommerce/components/gift-cards/GiftCardRedemptionPage.d.ts +36 -0
  78. package/dist/src/ecommerce/components/gift-cards/GiftCardRedemptionPage.d.ts.map +1 -0
  79. package/dist/src/ecommerce/components/orders/OrderCard.d.ts.map +1 -1
  80. package/dist/src/ecommerce/components/orders/OrderDetails.d.ts +5 -1
  81. package/dist/src/ecommerce/components/orders/OrderDetails.d.ts.map +1 -1
  82. package/dist/src/ecommerce/index.d.ts +6 -0
  83. package/dist/src/ecommerce/index.d.ts.map +1 -1
  84. package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts +1 -0
  85. package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts.map +1 -1
  86. package/dist/src/ecommerce/state/checkout/useCheckout.d.ts.map +1 -1
  87. package/dist/src/ecommerce/templates/ProductTemplate.d.ts.map +1 -1
  88. package/dist/src/ecommerce/templates/PurchaseHistoryTemplate.d.ts +5 -1
  89. package/dist/src/ecommerce/templates/PurchaseHistoryTemplate.d.ts.map +1 -1
  90. package/dist/src/ecommerce/types.d.ts +20 -0
  91. package/dist/src/ecommerce/types.d.ts.map +1 -1
  92. package/dist/src/ecommerce/utils/cartItemMetadata.d.ts.map +1 -1
  93. package/dist/src/ecommerce/utils/safeHref.d.ts +9 -0
  94. package/dist/src/ecommerce/utils/safeHref.d.ts.map +1 -0
  95. package/dist/src/hooks/useCreditsBalance.d.ts +32 -0
  96. package/dist/src/hooks/useCreditsBalance.d.ts.map +1 -0
  97. package/dist/src/index.d.ts +4 -0
  98. package/dist/src/index.d.ts.map +1 -1
  99. package/dist/src/managers/CreditsManager.d.ts +15 -0
  100. package/dist/src/managers/CreditsManager.d.ts.map +1 -1
  101. package/dist/src/managers/MeteoraPoolManager.d.ts +86 -0
  102. package/dist/src/managers/MeteoraPoolManager.d.ts.map +1 -0
  103. package/dist/stripe-only.js +1 -1
  104. package/dist/stripe-only.mjs +2 -2
  105. package/dist/{styles-BWrLnaUW.js → styles-21F1-oqx.js} +1 -1
  106. package/dist/{styles--eKKnfdj.mjs → styles-2VMpwuaI.mjs} +3 -3
  107. package/dist/testing/index.js +1 -1
  108. package/dist/testing/index.mjs +1 -1
  109. package/dist/{walletPool-BqNfOhB0.js → walletPool-Ddv33tej.js} +1 -1
  110. package/dist/{walletPool-DShNjCQ6.mjs → walletPool-DgQsh7Se.mjs} +1 -1
  111. package/package.json +5 -1
  112. package/dist/SingleCategorySettings-DhHGIGwB.mjs +0 -1418
  113. package/dist/SingleCategorySettings-DxjCafCk.js +0 -3
  114. package/dist/index-7YUxR4u5.js +0 -84
@@ -0,0 +1 @@
1
+ "use strict";var Se=Object.create;var ue=Object.defineProperty;var Ce=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,Te=Object.prototype.hasOwnProperty;var Ae=(t,s,n,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let r of ke(s))!Te.call(t,r)&&r!==n&&ue(t,r,{get:()=>s[r],enumerable:!(i=Ce(s,r))||i.enumerable});return t};var me=(t,s,n)=>(n=t!=null?Se(we(t)):{},Ae(s||!t||!t.__esModule?ue(n,"default",{value:t,enumerable:!0}):n,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),pe=require("./index-vEe2Y39x.js"),re=require("./configApi-CxEbCAgG.js"),be=[{value:"text",label:"Short Text"},{value:"email",label:"Email"},{value:"phone",label:"Phone"},{value:"address",label:"Address"},{value:"textarea",label:"Long Text"},{value:"dropdown",label:"Dropdown"},{value:"file_upload",label:"File Upload"}],he={fields:[],requiresApproval:!0},E={width:"100%",padding:"0.4rem 0.6rem",border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,fontSize:"0.9rem",boxSizing:"border-box"},O={display:"block",fontSize:"0.8rem",fontWeight:500,marginBottom:4},Y={padding:"0.4rem 1rem",borderRadius:6,border:"1px solid rgba(0,0,0,0.2)",background:"white",cursor:"pointer",fontSize:"0.85rem"};function Ne(){return{id:Math.random().toString(36).slice(2),label:"",fieldType:"text",required:!1,options:[],placeholder:""}}function ge({field:t,onSave:s,onCancel:n}){const[i,r]=d.useState(t),[o,u]=d.useState(""),m=l=>r(h=>({...h,...l})),y=()=>{const l=o.trim();l&&(m({options:[...i.options,l]}),u(""))};return e.jsxs("div",{style:{padding:"0.75rem",border:"1px solid rgba(37,99,235,0.3)",borderRadius:6,background:"#eff6ff",marginTop:6},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0.6rem",marginBottom:"0.6rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:O,children:"Label *"}),e.jsx("input",{style:E,value:i.label,onChange:l=>m({label:l.target.value}),placeholder:"e.g., Full Name"})]}),e.jsxs("div",{children:[e.jsx("label",{style:O,children:"Field Type"}),e.jsx("select",{style:E,value:i.fieldType,onChange:l=>m({fieldType:l.target.value,options:[]}),children:be.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:"0.6rem",alignItems:"end",marginBottom:"0.6rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:O,children:"Placeholder"}),e.jsx("input",{style:E,value:i.placeholder??"",onChange:l=>m({placeholder:l.target.value}),placeholder:"Optional hint text"})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"0.85rem",cursor:"pointer",paddingBottom:2},children:[e.jsx("input",{type:"checkbox",checked:i.required,onChange:l=>m({required:l.target.checked})})," Required"]})]}),i.fieldType==="dropdown"&&e.jsxs("div",{style:{marginBottom:"0.6rem"},children:[e.jsx("label",{style:O,children:"Options"}),i.options.map((l,h)=>e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:4},children:[e.jsx("span",{style:{flex:1,fontSize:"0.85rem",padding:"0.25rem 0.5rem",background:"white",border:"1px solid rgba(0,0,0,0.15)",borderRadius:4},children:l}),e.jsx("button",{type:"button",onClick:()=>m({options:i.options.filter((f,_)=>_!==h)}),style:{padding:"0.2rem 0.5rem",borderRadius:4,border:"1px solid rgba(0,0,0,0.2)",background:"white",cursor:"pointer",fontSize:"0.8rem",color:"#dc2626"},children:"x"})]},h)),e.jsxs("div",{style:{display:"flex",gap:6},children:[e.jsx("input",{style:{...E,flex:1},value:o,onChange:l=>u(l.target.value),onKeyDown:l=>l.key==="Enter"&&(l.preventDefault(),y()),placeholder:"Add option..."}),e.jsx("button",{type:"button",onClick:y,style:Y,children:"Add"})]})]}),e.jsxs("div",{style:{display:"flex",gap:6},children:[e.jsx("button",{type:"button",onClick:()=>s(i),disabled:!i.label.trim(),style:{padding:"0.35rem 1rem",borderRadius:6,border:"none",background:"#2563eb",color:"white",cursor:i.label.trim()?"pointer":"not-allowed",fontSize:"0.85rem",opacity:i.label.trim()?1:.5},children:"Save Field"}),e.jsx("button",{type:"button",onClick:n,style:Y,children:"Cancel"})]})]})}function ze({fields:t,instructions:s}){const n={...E,fontSize:"0.85rem",background:"white",opacity:.6};return e.jsxs("div",{style:{padding:"1rem",border:"1px solid rgba(0,0,0,0.1)",borderRadius:8,background:"rgba(0,0,0,0.02)"},children:[e.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"rgba(0,0,0,0.4)",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:"0.75rem"},children:"Preview — Redeemer View"}),s&&e.jsx("div",{style:{padding:"0.6rem 0.75rem",background:"#fffbeb",border:"1px solid #fcd34d",borderRadius:6,fontSize:"0.85rem",marginBottom:"0.75rem",color:"#92400e"},children:s}),t.length===0&&e.jsx("div",{style:{fontSize:"0.85rem",color:"rgba(0,0,0,0.35)",fontStyle:"italic"},children:"No fields added yet."}),t.map(i=>e.jsxs("div",{style:{marginBottom:"0.6rem"},children:[e.jsxs("label",{style:{display:"block",fontSize:"0.8rem",fontWeight:500,marginBottom:4},children:[i.label||"Unlabelled field",i.required&&e.jsx("span",{style:{color:"#dc2626",marginLeft:2},children:"*"})]}),i.fieldType==="textarea"&&e.jsx("textarea",{disabled:!0,rows:2,placeholder:i.placeholder??"",style:{...n,resize:"none"}}),i.fieldType==="file_upload"&&e.jsx("div",{style:{padding:"0.5rem",border:"1px dashed rgba(0,0,0,0.25)",borderRadius:4,fontSize:"0.8rem",color:"rgba(0,0,0,0.4)",textAlign:"center"},children:"File upload"}),i.fieldType==="dropdown"&&e.jsxs("select",{disabled:!0,style:n,children:[e.jsx("option",{children:i.placeholder||"Select..."}),i.options.map((r,o)=>e.jsx("option",{children:r},o))]}),!["textarea","file_upload","dropdown"].includes(i.fieldType)&&e.jsx("input",{disabled:!0,type:i.fieldType==="email"?"email":i.fieldType==="phone"?"tel":"text",placeholder:i.placeholder??"",style:n})]},i.id))]})}function Be({value:t,onChange:s}){const n=t!==null,i=t??he,[r,o]=d.useState(null),[u,m]=d.useState(null),[y,l]=d.useState(!1),h=p=>s({...i,...p}),f=()=>{o(null),m(null)},_=p=>{s(p?{...he}:null),f()},b=()=>{const p=Ne();m(p),o("new")},g=p=>{m({...p}),o(p.id)},j=p=>{h({fields:r==="new"?[...i.fields,p]:i.fields.map(C=>C.id===p.id?p:C)}),f()},k=p=>{r===p&&f(),h({fields:i.fields.filter(C=>C.id!==p)})};return e.jsxs("div",{children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer",marginBottom:n?"1rem":4,fontSize:"0.9rem",fontWeight:500},children:[e.jsx("input",{type:"checkbox",checked:n,onChange:p=>_(p.target.checked)}),"Enable Redemption Form"]}),!n&&e.jsx("div",{style:{fontSize:"0.8rem",color:"rgba(0,0,0,0.4)"},children:"No redemption form — token holders cannot request physical redemption."}),n&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:O,children:"Instructions shown to redeemer"}),e.jsx("textarea",{value:i.instructions??"",onChange:p=>h({instructions:p.target.value||void 0}),placeholder:"Describe requirements, turnaround times, etc.",rows:3,style:{...E,resize:"vertical"}})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"1rem",alignItems:"center",padding:"0.6rem 0.75rem",border:"1px solid rgba(0,0,0,0.1)",borderRadius:6,background:"rgba(0,0,0,0.02)"},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"0.85rem",cursor:"pointer",whiteSpace:"nowrap"},children:[e.jsx("input",{type:"checkbox",checked:i.requiresApproval,onChange:p=>h({requiresApproval:p.target.checked})})," Requires admin approval"]}),e.jsxs("div",{children:[e.jsx("label",{style:O,children:"Estimated processing days"}),e.jsx("input",{type:"number",min:0,value:i.estimatedProcessingDays??"",onChange:p=>h({estimatedProcessingDays:p.target.value?Number(p.target.value):void 0}),placeholder:"e.g., 5",style:{...E,maxWidth:120}})]})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:"0.8rem",fontWeight:500,marginBottom:"0.5rem"},children:["Form Fields (",i.fields.length,")"]}),i.fields.length===0&&r!=="new"&&e.jsx("div",{style:{fontSize:"0.85rem",color:"rgba(0,0,0,0.35)",fontStyle:"italic",marginBottom:"0.5rem"},children:"No fields yet. Add fields below."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.4rem"},children:[i.fields.map(p=>e.jsxs("div",{children:[e.jsxs("div",{style:{padding:"0.5rem 0.75rem",border:"1px solid rgba(0,0,0,0.1)",borderRadius:6,background:"white",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:"0.9rem"},children:p.label||e.jsx("em",{style:{color:"rgba(0,0,0,0.35)"},children:"Unlabelled"})}),e.jsx("span",{style:{padding:"2px 8px",borderRadius:10,background:"#dbeafe",color:"#1d4ed8",fontSize:"0.75rem"},children:be.find(C=>C.value===p.fieldType)?.label??p.fieldType}),p.required&&e.jsx("span",{style:{padding:"2px 8px",borderRadius:10,background:"#fef3c7",color:"#92400e",fontSize:"0.75rem"},children:"required"})]}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("button",{type:"button",onClick:()=>g(p),style:{...Y,padding:"0.25rem 0.6rem",fontSize:"0.8rem"},children:"Edit"}),e.jsx("button",{type:"button",onClick:()=>k(p.id),style:{padding:"0.25rem 0.6rem",borderRadius:4,border:"1px solid rgba(220,38,38,0.3)",background:"white",cursor:"pointer",fontSize:"0.8rem",color:"#dc2626"},children:"Delete"})]})]}),r===p.id&&u&&e.jsx(ge,{field:u,onSave:j,onCancel:f})]},p.id)),r==="new"&&u&&e.jsx(ge,{field:u,onSave:j,onCancel:f})]}),r===null&&e.jsx("button",{type:"button",onClick:b,style:{...Y,marginTop:"0.5rem"},children:"+ Add Field"})]}),e.jsxs("div",{children:[e.jsx("button",{type:"button",onClick:()=>l(p=>!p),style:{...Y,background:y?"rgba(0,0,0,0.05)":"white"},children:y?"Hide Preview":"Show Preview"}),y&&e.jsx("div",{style:{marginTop:"0.75rem"},children:e.jsx(ze,{fields:i.fields,instructions:i.instructions})})]})]})]})}const Pe=[{value:"securities",label:"Securities (fungible)"},{value:"commodities",label:"Commodities (fungible)"},{value:"property",label:"Property (non-fungible)"},{value:"collectibles",label:"Collectibles (non-fungible)"}],Me=t=>t==="securities"||t==="commodities";function De({c:t,onDeployPool:s,onEdit:n,onDelete:i}){const r=t.tokenizationConfig,o=Me(r.assetClass);return e.jsxs("div",{style:{padding:"0.75rem 1rem",border:"1px solid rgba(0,0,0,0.1)",borderRadius:8,background:"white"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[e.jsx("strong",{children:t.name}),e.jsx("span",{style:{marginLeft:8,fontSize:"0.8rem",padding:"2px 8px",borderRadius:10,background:o?"#dbeafe":"#fef3c7",color:o?"#1d4ed8":"#92400e"},children:r.assetClass}),r.tokenSymbol&&e.jsx("span",{style:{marginLeft:6,fontSize:"0.8rem",color:"rgba(0,0,0,0.5)"},children:r.tokenSymbol})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.8rem"},children:[r.mintAddress?e.jsx("span",{style:{color:"#16a34a"},children:"Mint initialized"}):e.jsx("span",{style:{color:"rgba(0,0,0,0.4)"},children:"No mint"}),o&&r.mintAddress&&(r.liquidityPoolAddress?e.jsxs("span",{style:{padding:"2px 8px",borderRadius:10,background:"#dcfce7",color:"#15803d",fontSize:"0.75rem"},children:["Pool Active · ",r.liquidityPoolAddress.slice(0,4),"...",r.liquidityPoolAddress.slice(-4)]}):e.jsx("button",{type:"button",onClick:s,style:{padding:0,border:"none",background:"none",color:"#2563eb",cursor:"pointer",fontSize:"0.8rem",textDecoration:"underline"},children:"Deploy Pool"}))]})]}),t.description&&e.jsx("div",{style:{fontSize:"0.85rem",color:"rgba(0,0,0,0.5)",marginTop:4},children:t.description}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:6},children:[e.jsxs("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",fontSize:"0.8rem",color:"rgba(0,0,0,0.4)"},children:[e.jsxs("span",{children:["Fee: ",r.transferFeeBps," bps"]}),r.treasuryAddress&&e.jsxs("span",{children:["Treasury: ",r.treasuryAddress.slice(0,8),"..."]}),r.allowedJurisdictions?.length>0&&e.jsxs("span",{style:{padding:"1px 7px",borderRadius:10,background:"#f3f4f6",color:"rgba(0,0,0,0.55)"},children:[r.allowedJurisdictions.length," jurisdiction",r.allowedJurisdictions.length!==1?"s":"",": ",r.allowedJurisdictions.join(", ")]})]}),e.jsxs("div",{style:{display:"flex",gap:6},children:[n&&e.jsx("button",{type:"button",onClick:n,style:{padding:"2px 10px",border:"1px solid rgba(0,0,0,0.15)",borderRadius:4,background:"white",cursor:"pointer",fontSize:"0.75rem",color:"#2563eb"},children:"Edit"}),i&&e.jsx("button",{type:"button",onClick:i,style:{padding:"2px 10px",border:"1px solid rgba(0,0,0,0.15)",borderRadius:4,background:"white",cursor:"pointer",fontSize:"0.75rem",color:"#dc2626"},children:"Delete"})]})]})]})}const ne={name:"",description:"",assetClass:"securities",tokenSymbol:"",tokenDecimals:2,transferFeeBps:250,maxTransferFee:500,treasuryAddress:"",regulatoryNotice:"",jurisdictions:"",redemptionConfig:null};function Re({serverUrl:t,apiKey:s,authManager:n,onNavigateToLiquidity:i}){const[r,o]=d.useState([]),[u,m]=d.useState(!0),[y,l]=d.useState(null),[h,f]=d.useState(!1),[_,b]=d.useState(!1),[g,j]=d.useState(ne),[k,p]=d.useState(null),C=d.useCallback(async(c,x)=>{if(n?.isAuthenticated())return n.fetchWithAuth(c,x);const D={"Content-Type":"application/json"};s&&(D["X-API-Key"]=s);const v=await fetch(`${t}${c}`,{...x,headers:{...D,...x?.headers}});if(!v.ok){const N=await v.text().catch(()=>`HTTP ${v.status}`);throw new Error(N)}return v.json()},[t,s,n]),w=d.useCallback(async()=>{try{m(!0),l(null);const c=await C("/admin/collections");o((c.collections||[]).filter(x=>x.tokenizationConfig))}catch(c){l(c instanceof Error?c.message:"Failed to load asset classes")}finally{m(!1)}},[C]);d.useEffect(()=>{w()},[w]);const a=()=>({name:g.name.trim(),description:g.description||void 0,active:!0,productIds:[],tokenizationConfig:{assetClass:g.assetClass,tokenSymbol:g.tokenSymbol||void 0,tokenDecimals:g.tokenDecimals,transferFeeBps:g.transferFeeBps,maxTransferFee:g.maxTransferFee,treasuryAddress:g.treasuryAddress||void 0,regulatoryNotice:g.regulatoryNotice||void 0,allowedJurisdictions:g.jurisdictions?g.jurisdictions.split(",").map(c=>c.trim().toUpperCase()).filter(Boolean):[],redemptionConfig:g.redemptionConfig||void 0}}),S=async()=>{if(g.name.trim()){b(!0),l(null);try{k?await C(`/admin/collections/${encodeURIComponent(k)}`,{method:"PUT",body:JSON.stringify(a())}):await C("/admin/collections",{method:"POST",body:JSON.stringify(a())}),j(ne),f(!1),p(null),await w()}catch(c){l(c instanceof Error?c.message:`Failed to ${k?"update":"create"} asset class`)}finally{b(!1)}}},A=c=>{const x=c.tokenizationConfig;j({name:c.name,description:c.description??"",assetClass:x.assetClass,tokenSymbol:x.tokenSymbol??"",tokenDecimals:x.tokenDecimals,transferFeeBps:x.transferFeeBps,maxTransferFee:x.maxTransferFee,treasuryAddress:x.treasuryAddress??"",regulatoryNotice:x.regulatoryNotice??"",jurisdictions:x.allowedJurisdictions.join(", "),redemptionConfig:null}),p(c.id),f(!0)},T=async c=>{if(window.confirm(`Delete asset class "${c.name}"? This cannot be undone.`)){l(null);try{await C(`/admin/collections/${encodeURIComponent(c.id)}`,{method:"DELETE"}),await w()}catch(x){l(x instanceof Error?x.message:"Failed to delete asset class")}}};return u?e.jsx("div",{style:{padding:"1rem 0",color:"rgba(0,0,0,0.5)"},children:"Loading asset classes..."}):e.jsxs("div",{children:[y&&e.jsx("div",{style:{padding:"0.75rem 1rem",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:6,color:"#dc2626",marginBottom:"1rem",fontSize:"0.9rem"},children:y}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem"},children:[e.jsxs("h4",{style:{margin:0},children:["Asset Classes (",r.length,")"]}),e.jsx("button",{type:"button",onClick:()=>{f(!h),h&&(p(null),j(ne))},style:{padding:"0.4rem 1rem",borderRadius:6,border:"1px solid rgba(0,0,0,0.2)",background:h?"rgba(0,0,0,0.05)":"white",cursor:"pointer",fontSize:"0.85rem"},children:h?"Cancel":"+ New Asset Class"})]}),h&&e.jsxs("div",{style:{padding:"1rem",border:"1px solid rgba(0,0,0,0.1)",borderRadius:8,marginBottom:"1rem",background:"rgba(0,0,0,0.02)"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0.75rem",marginBottom:"0.75rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.8rem",fontWeight:500,marginBottom:4},children:"Name *"}),e.jsx("input",{type:"text",value:g.name,onChange:c=>j(x=>({...x,name:c.target.value})),placeholder:"e.g., Gold Tokens",style:{width:"100%",padding:"0.4rem 0.6rem",border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,fontSize:"0.9rem"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.8rem",fontWeight:500,marginBottom:4},children:"Asset Class *"}),e.jsx("select",{value:g.assetClass,onChange:c=>j(x=>({...x,assetClass:c.target.value})),style:{width:"100%",padding:"0.4rem 0.6rem",border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,fontSize:"0.9rem"},children:Pe.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"0.75rem",marginBottom:"0.75rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.8rem",fontWeight:500,marginBottom:4},children:"Token Symbol"}),e.jsx("input",{type:"text",value:g.tokenSymbol,onChange:c=>j(x=>({...x,tokenSymbol:c.target.value})),placeholder:"e.g., GOLD",style:{width:"100%",padding:"0.4rem 0.6rem",border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,fontSize:"0.9rem"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.8rem",fontWeight:500,marginBottom:4},children:"Transfer Fee (bps)"}),e.jsx("input",{type:"number",value:g.transferFeeBps,onChange:c=>j(x=>({...x,transferFeeBps:Number(c.target.value)})),style:{width:"100%",padding:"0.4rem 0.6rem",border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,fontSize:"0.9rem"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.8rem",fontWeight:500,marginBottom:4},children:"Treasury Address"}),e.jsx("input",{type:"text",value:g.treasuryAddress,onChange:c=>j(x=>({...x,treasuryAddress:c.target.value})),placeholder:"Solana address",style:{width:"100%",padding:"0.4rem 0.6rem",border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,fontSize:"0.9rem"}})]})]}),e.jsxs("div",{style:{marginBottom:"0.75rem"},children:[e.jsx("label",{style:{display:"block",fontSize:"0.8rem",fontWeight:500,marginBottom:4},children:"Allowed Jurisdictions"}),e.jsx("input",{type:"text",value:g.jurisdictions,onChange:c=>j(x=>({...x,jurisdictions:c.target.value})),placeholder:"US, CA, GB (comma-separated, leave empty for all)",style:{width:"100%",padding:"0.4rem 0.6rem",border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,fontSize:"0.9rem"}})]}),e.jsxs("div",{style:{marginBottom:"0.75rem"},children:[e.jsx("label",{style:{display:"block",fontSize:"0.8rem",fontWeight:500,marginBottom:4},children:"Regulatory Notice"}),e.jsx("textarea",{value:g.regulatoryNotice,onChange:c=>j(x=>({...x,regulatoryNotice:c.target.value})),placeholder:"Shown to buyers before purchase",rows:2,style:{width:"100%",padding:"0.4rem 0.6rem",border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,fontSize:"0.9rem",resize:"vertical"}})]}),e.jsxs("div",{style:{marginBottom:"0.75rem"},children:[e.jsx("label",{style:{display:"block",fontSize:"0.8rem",fontWeight:600,marginBottom:8},children:"Redemption Form"}),e.jsx(Be,{value:g.redemptionConfig,onChange:c=>j(x=>({...x,redemptionConfig:c}))})]}),e.jsx("button",{type:"button",onClick:S,disabled:_||!g.name.trim(),style:{padding:"0.5rem 1.5rem",borderRadius:6,border:"none",background:"#2563eb",color:"white",cursor:_?"wait":"pointer",fontSize:"0.9rem",opacity:_?.6:1},children:_?"Saving...":k?"Save Changes":"Create Asset Class"})]}),r.length===0?e.jsx("div",{style:{padding:"2rem",textAlign:"center",color:"rgba(0,0,0,0.4)",fontSize:"0.9rem"},children:"No asset classes configured. Create one to start tokenizing off-chain assets."}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:r.map(c=>e.jsx(De,{c,onDeployPool:i,onEdit:()=>A(c),onDelete:()=>T(c)},c.id))})]})}const Ie=[{value:"",label:"All statuses"},{value:"pending_info",label:"Pending Info"},{value:"info_submitted",label:"Info Submitted"},{value:"under_review",label:"Under Review"},{value:"approved",label:"Approved"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}];function Fe(t){switch(t){case"pending_info":return"cedros-admin__badge cedros-admin__badge--muted";case"info_submitted":return"cedros-admin__badge cedros-admin__badge--info";case"under_review":return"cedros-admin__badge cedros-admin__badge--warning";case"approved":return"cedros-admin__badge cedros-admin__badge--success";case"completed":return"cedros-admin__badge cedros-admin__badge--success";case"rejected":return"cedros-admin__badge cedros-admin__badge--failed";default:return"cedros-admin__badge cedros-admin__badge--muted"}}function Le(t){return t.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function Ee(t){return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function q(t){return t.length>12?`${t.slice(0,8)}…`:t}function ye(t){return`https://solscan.io/tx/${t}`}function Oe({redemption:t,onAction:s,onComplete:n,actionBusy:i}){const[r,o]=d.useState(t.adminNotes??""),u=Object.entries(t.formData??{});return e.jsx("div",{style:{padding:"1rem 1.25rem",background:"rgba(0,0,0,0.02)",borderTop:"1px solid rgba(0,0,0,0.08)"},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"1.5rem"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:600,fontSize:"0.8rem",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.05em",opacity:.6},children:"Form Data"}),u.length===0?e.jsx("div",{style:{fontSize:"0.85rem",opacity:.5},children:"No form data submitted."}):e.jsx("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",fontSize:"0.85rem"},children:u.map(([m,y])=>e.jsxs(e.Fragment,{children:[e.jsx("dt",{style:{fontWeight:500,color:"rgba(0,0,0,0.6)",whiteSpace:"nowrap"},children:m},`k-${m}`),e.jsx("dd",{style:{margin:0,wordBreak:"break-word"},children:String(y??"—")},`v-${m}`)]}))}),(t.tokenMintSignature||t.tokenBurnSignature)&&e.jsxs("div",{style:{marginTop:12,fontSize:"0.8rem"},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:4,opacity:.6,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Signatures"}),t.tokenMintSignature&&e.jsxs("div",{children:["Mint:"," ",e.jsx("a",{href:ye(t.tokenMintSignature),target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"monospace",fontSize:"0.75rem"},children:q(t.tokenMintSignature)})]}),t.tokenBurnSignature&&e.jsxs("div",{children:["Burn:"," ",e.jsx("a",{href:ye(t.tokenBurnSignature),target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"monospace",fontSize:"0.75rem"},children:q(t.tokenBurnSignature)})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.8rem",fontWeight:500,marginBottom:4},children:"Admin Notes"}),e.jsx("textarea",{value:r,onChange:m=>o(m.target.value),rows:4,style:{width:"100%",padding:"0.4rem 0.6rem",border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,fontSize:"0.85rem",resize:"vertical",boxSizing:"border-box"},placeholder:"Internal notes (not shown to user)..."}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:8,flexWrap:"wrap"},children:[t.status==="info_submitted"&&e.jsx("button",{className:"cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",disabled:i,onClick:()=>s(t.id,"under_review",r),children:i?"Saving...":"Mark Under Review"}),t.status==="under_review"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",disabled:i,onClick:()=>s(t.id,"approved",r),children:i?"Saving...":"Approve"}),e.jsx("button",{className:"cedros-admin__button cedros-admin__button--outline cedros-admin__button--danger cedros-admin__button--sm",disabled:i,onClick:()=>s(t.id,"rejected",r),children:i?"Saving...":"Reject"})]}),t.status==="approved"&&e.jsx("button",{className:"cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",disabled:i,onClick:()=>n(t.id),children:i?"Processing...":"Complete"})]})]})]})})}function qe({serverUrl:t,apiKey:s,authManager:n}){const[i,r]=d.useState([]),[o,u]=d.useState(!0),[m,y]=d.useState(null),[l,h]=d.useState(""),[f,_]=d.useState(null),[b,g]=d.useState(null),j=d.useCallback(async(a,S)=>{if(n?.isAuthenticated())return n.fetchWithAuth(a,S);const A={"Content-Type":"application/json"};s&&(A["X-API-Key"]=s);const T=await fetch(`${t}${a}`,{...S,headers:{...A,...S?.headers}});if(!T.ok){const c=await T.text().catch(()=>`HTTP ${T.status}`);throw new Error(c)}return T.json()},[t,s,n]),k=d.useCallback(async()=>{u(!0),y(null);try{const a=l?`?status=${encodeURIComponent(l)}&limit=50&offset=0`:"?limit=50&offset=0",S=await j(`/admin/asset-redemptions${a}`);r(S.redemptions??[])}catch(a){y(a instanceof Error?a.message:"Failed to load redemptions")}finally{u(!1)}},[j,l]);d.useEffect(()=>{k()},[k]);const p=d.useCallback(async(a,S,A)=>{g(a),y(null);try{await j(`/admin/asset-redemptions/${a}/status`,{method:"PATCH",body:JSON.stringify({status:S,adminNotes:A})}),_(null),await k()}catch(T){y(T instanceof Error?T.message:"Failed to update status")}finally{g(null)}},[j,k]),C=d.useCallback(async a=>{g(a),y(null);try{await j(`/admin/asset-redemptions/${a}/complete`,{method:"POST"}),_(null),await k()}catch(S){y(S instanceof Error?S.message:"Failed to complete redemption")}finally{g(null)}},[j,k]),w=a=>{_(S=>S===a?null:a)};return e.jsxs("div",{className:"cedros-admin__page",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"1rem",flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.8rem",fontWeight:500,marginBottom:4},children:"Status"}),e.jsx("select",{value:l,onChange:a=>{h(a.target.value),_(null)},style:{padding:"0.4rem 0.6rem",border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,fontSize:"0.9rem",minWidth:160},children:Ie.map(a=>e.jsx("option",{value:a.value,children:a.label},a.value))})]}),e.jsx("div",{style:{alignSelf:"flex-end"},children:e.jsx("button",{className:"cedros-admin__button cedros-admin__button--outline",onClick:k,disabled:o,children:o?"Loading...":"Refresh"})})]}),m&&e.jsx("div",{style:{padding:"0.75rem 1rem",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:6,color:"#dc2626",marginBottom:"1rem",fontSize:"0.9rem"},children:m}),o?e.jsx("div",{className:"cedros-admin__loading",children:"Loading redemptions..."}):i.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"No redemption requests 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:"Date"}),e.jsx("th",{children:"Order"}),e.jsx("th",{children:"Product"}),e.jsx("th",{children:"Collection"}),e.jsx("th",{children:"User"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:i.map(a=>e.jsxs(e.Fragment,{children:[e.jsxs("tr",{style:{cursor:"pointer"},onClick:()=>w(a.id),children:[e.jsx("td",{children:Ee(a.createdAt)}),e.jsx("td",{children:e.jsx("code",{title:a.orderId,children:q(a.orderId)})}),e.jsx("td",{children:e.jsx("code",{title:a.productId,children:q(a.productId)})}),e.jsx("td",{children:e.jsx("code",{title:a.collectionId,children:q(a.collectionId)})}),e.jsx("td",{children:a.userId?e.jsx("code",{title:a.userId,children:q(a.userId)}):e.jsx("span",{style:{opacity:.4},children:"—"})}),e.jsx("td",{children:e.jsx("span",{className:Fe(a.status),children:Le(a.status)})}),e.jsx("td",{onClick:S=>S.stopPropagation(),children:e.jsxs("div",{style:{display:"flex",gap:"0.4rem",flexWrap:"wrap"},children:[(a.status==="info_submitted"||a.status==="under_review"||a.status==="approved")&&e.jsx("button",{className:"cedros-admin__button cedros-admin__button--outline cedros-admin__button--sm",onClick:()=>w(a.id),children:f===a.id?"Close":"Review"}),a.status==="under_review"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",disabled:b===a.id,onClick:()=>p(a.id,"approved",a.adminNotes??""),children:"Approve"}),e.jsx("button",{className:"cedros-admin__button cedros-admin__button--outline cedros-admin__button--danger cedros-admin__button--sm",disabled:b===a.id,onClick:()=>p(a.id,"rejected",a.adminNotes??""),children:"Reject"})]}),a.status==="approved"&&e.jsx("button",{className:"cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",disabled:b===a.id,onClick:()=>C(a.id),children:b===a.id?"Processing...":"Complete"})]})})]},a.id),f===a.id&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,style:{padding:0},children:e.jsx(Oe,{redemption:a,onAction:p,onComplete:C,actionBusy:b===a.id})})},`${a.id}-detail`)]}))})]})})]})}const $e={CA:{cashOutCents:1500,expirationProhibited:!0,escheatmentYears:3,notes:"Cash-out threshold increases to $15 on April 1, 2026."},CO:{cashOutCents:500,escheatmentYears:5},CT:{cashOutCents:300,escheatmentYears:3},FL:{expirationProhibited:!0,escheatmentYears:5},ME:{cashOutCents:500,escheatmentYears:3},MA:{cashOutCents:500,escheatmentYears:3,notes:"Cash-out also required when 90% of value is used."},MT:{cashOutCents:500,escheatmentYears:5},NJ:{cashOutCents:500,escheatmentYears:3},OR:{cashOutCents:500,escheatmentYears:3,notes:"May require at least one prior transaction."},RI:{cashOutCents:100,escheatmentYears:3},TX:{cashOutCents:250,escheatmentYears:3},VT:{cashOutCents:100,escheatmentYears:3},WA:{cashOutCents:500,escheatmentYears:5},PR:{cashOutCents:500,escheatmentYears:5}},ae={escheatmentYears:5},V=1e6,We={AL:"Alabama",AK:"Alaska",AZ:"Arizona",AR:"Arkansas",CA:"California",CO:"Colorado",CT:"Connecticut",DE:"Delaware",FL:"Florida",GA:"Georgia",HI:"Hawaii",ID:"Idaho",IL:"Illinois",IN:"Indiana",IA:"Iowa",KS:"Kansas",KY:"Kentucky",LA:"Louisiana",ME:"Maine",MD:"Maryland",MA:"Massachusetts",MI:"Michigan",MN:"Minnesota",MS:"Mississippi",MO:"Missouri",MT:"Montana",NE:"Nebraska",NV:"Nevada",NH:"New Hampshire",NJ:"New Jersey",NM:"New Mexico",NY:"New York",NC:"North Carolina",ND:"North Dakota",OH:"Ohio",OK:"Oklahoma",OR:"Oregon",PA:"Pennsylvania",RI:"Rhode Island",SC:"South Carolina",SD:"South Dakota",TN:"Tennessee",TX:"Texas",UT:"Utah",VT:"Vermont",VA:"Virginia",WA:"Washington",WV:"West Virginia",WI:"Wisconsin",WY:"Wyoming",DC:"District of Columbia",PR:"Puerto Rico"};function Ye({serverUrl:t,authManager:s}){const[n,i]=d.useState(null),[r,o]=d.useState(null),[u,m]=d.useState(null),[y,l]=d.useState(!0),h=d.useCallback(async()=>{try{const j=(await new re.ConfigApiClient(t,void 0,s).getConfig("gift_cards")).config??{};i(j.business_state||null),o(j.min_gift_card_value_cents!=null?Number(j.min_gift_card_value_cents):null),m(j.max_gift_card_value_cents!=null?Number(j.max_gift_card_value_cents):null)}catch{}finally{l(!1)}},[t,s]);if(d.useEffect(()=>{h()},[h]),y)return e.jsx("div",{style:{padding:"2rem",textAlign:"center",opacity:.6},children:"Loading compliance data..."});const f=n?$e[n]??ae:null,_=n?We[n]??n:null;return e.jsx("div",{children:n?e.jsxs(e.Fragment,{children:[e.jsxs("h3",{className:"cedros-admin__section-title",style:{marginBottom:"1rem"},children:["Compliance Guidance — ",_]}),e.jsxs("div",{style:{display:"grid",gap:"1rem",maxWidth:720},children:[e.jsx(Ke,{reg:f,minValueCents:r}),e.jsx(He,{reg:f}),e.jsx(Ge,{reg:f}),e.jsx(Je,{maxValueCents:u})]}),e.jsx(Ve,{reg:f,minValueCents:r,maxValueCents:u})]}):e.jsx(Ue,{})})}function Ue(){return e.jsxs("div",{style:{padding:"2rem",textAlign:"center"},children:[e.jsx("p",{style:{fontSize:15,opacity:.7,marginBottom:"0.5rem"},children:"No business state configured."}),e.jsxs("p",{style:{fontSize:13,opacity:.5},children:["Set your ",e.jsx("strong",{children:"business_state"})," in the Gift Cards config category to see state-specific compliance guidance."]})]})}function U({title:t,children:s}){return e.jsxs("div",{style:{border:"1px solid rgba(0,0,0,0.1)",borderRadius:8,padding:"1rem 1.25rem"},children:[e.jsx("h4",{style:{margin:"0 0 0.5rem",fontSize:14,fontWeight:600},children:t}),e.jsx("div",{style:{fontSize:13,lineHeight:1.6},children:s})]})}function Ke({reg:t,minValueCents:s}){if(!t.cashOutCents)return e.jsx(U,{title:"Cash-Out Threshold",children:e.jsx("p",{style:{margin:0},children:"Your state does not have a specific cash-out threshold for gift cards. Federal law does not require cash redemption."})});const n=(t.cashOutCents/100).toFixed(2),i=s!=null&&s>t.cashOutCents;return e.jsxs(U,{title:"Cash-Out Threshold",children:[e.jsxs("p",{style:{margin:"0 0 0.5rem"},children:["Your state requires cash redemption for gift cards with a remaining balance of ",e.jsxs("strong",{children:["$",n]})," or less."]}),e.jsxs("p",{style:{margin:"0 0 0.5rem"},children:["Since this system uses ",e.jsx("strong",{children:"one-shot full redemption"})," (entire gift card value is converted to credits at once), cash-out is avoided by setting the minimum gift card face value above the threshold."]}),i?e.jsxs(X,{ok:!0,children:["Min value ($",((s??0)/100).toFixed(2),") exceeds threshold"]}):e.jsxs(X,{ok:!1,children:["Set ",e.jsx("code",{children:"min_gift_card_value_cents"})," above ",t.cashOutCents," to avoid cash-out obligations"]}),t.notes&&e.jsx("p",{style:{margin:"0.5rem 0 0",opacity:.7,fontStyle:"italic"},children:t.notes})]})}function He({reg:t}){return e.jsx(U,{title:"Expiration Rules",children:t.expirationProhibited?e.jsxs("p",{style:{margin:0},children:["Your state ",e.jsx("strong",{children:"prohibits"})," gift card expiration. Do not set expiration dates on gift cards."]}):e.jsxs("p",{style:{margin:0},children:["Federal law (CARD Act) requires gift cards to remain valid for at least ",e.jsx("strong",{children:"5 years"})," from purchase or last reload. Your state follows the federal minimum."]})})}function Ge({reg:t}){const s=t.escheatmentYears??ae.escheatmentYears;return e.jsxs(U,{title:"Escheatment (Unclaimed Property)",children:[e.jsxs("p",{style:{margin:"0 0 0.5rem"},children:["Gift card balances unredeemed for ",e.jsxs("strong",{children:[s," years"]})," may need to be reported and remitted to the state as unclaimed property."]}),e.jsxs("p",{style:{margin:0,opacity:.7},children:["The system tracks ",e.jsx("code",{children:"last_activity_at"})," on gift card redemptions to help identify dormant balances approaching the escheatment window."]})]})}function Je({maxValueCents:t}){const s=t??V,n=s<=V;return e.jsxs(U,{title:"Anti-Money Laundering (AML)",children:[e.jsxs("p",{style:{margin:"0 0 0.5rem"},children:["FinCEN requires closed-loop prepaid cards to stay at or below ",e.jsx("strong",{children:"$10,000"})," per card. The server enforces this cap on product creation."]}),n?e.jsxs(X,{ok:!0,children:["Max value ($",(s/100).toFixed(2),") within AML limit"]}):e.jsxs(X,{ok:!1,children:[e.jsx("code",{children:"max_gift_card_value_cents"})," exceeds $10,000 AML cap"]})]})}function X({ok:t,children:s}){return e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:6,fontSize:13,fontWeight:500,background:t?"rgba(34,197,94,0.1)":"rgba(234,179,8,0.15)",color:t?"#16a34a":"#a16207"},children:[e.jsx("span",{children:t?"✓":"⚠"}),s]})}function Ve({reg:t,minValueCents:s,maxValueCents:n}){const r=[{label:"AML: Max card value ≤ $10,000",ok:(n??V)<=V},...t.cashOutCents?[{label:`Cash-out: Min value > $${(t.cashOutCents/100).toFixed(2)} threshold`,ok:s!=null&&s>t.cashOutCents}]:[],{label:t.expirationProhibited?"Expiration: State prohibits expiration (no action needed)":"Expiration: Federal 5-year minimum applies",ok:!0},{label:`Escheatment: ${t.escheatmentYears??ae.escheatmentYears}-year dormancy tracking enabled`,ok:!0}];return e.jsxs("div",{style:{marginTop:"1.5rem"},children:[e.jsx("h4",{style:{fontSize:14,fontWeight:600,marginBottom:"0.75rem"},children:"Compliance Checklist"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:r.map((o,u)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13},children:[e.jsx("span",{style:{color:o.ok?"#16a34a":"#d97706",fontWeight:600},children:o.ok?"✓":"⚠"}),e.jsx("span",{children:o.label})]},u))})]})}const Xe=0;class Ze{dlmmModule=null;bnClass=null;keypairClass=null;async loadDLMM(){if(this.dlmmModule)return this.dlmmModule;try{const s=await Promise.resolve().then(()=>require("./pay-react_false-DaeIe3_l.js"));return this.dlmmModule=s.default??s,this.dlmmModule}catch{throw new Error("Install @meteora-ag/dlmm to enable pool deployment: npm install @meteora-ag/dlmm")}}async loadBN(){if(this.bnClass)return this.bnClass;const s=await Promise.resolve().then(()=>require("./bn-RbgIlcHc.js")).then(n=>n.bn);return this.bnClass=s.default??s,this.bnClass}async loadKeypair(){if(this.keypairClass)return this.keypairClass;const{Keypair:s}=await import("@solana/web3.js");return this.keypairClass=s,this.keypairClass}async computeBinId(s,n,i,r=1){const o=await this.loadDLMM(),u=o.getPricePerLamport(n,i,s);return o.getBinIdFromPrice(u,r,!0)}async findPresetParameter(s,n,i){const r=await this.loadDLMM(),o=i?{cluster:i}:void 0,{presetParameter2:u}=await r.getAllPresetParameters(s,o),m=u.find(y=>y.account.binStep===n);if(!m)throw new Error(`No PresetParameter2 found for binStep=${n}. Available: ${u.map(y=>y.account.binStep).join(", ")}`);return m.publicKey}async createPool(s,n,i,r,o,u=1,m){const y=await this.loadDLMM(),l=await this.loadBN(),h=m?{cluster:m}:void 0,f=await this.findPresetParameter(s,u,m),_=await y.createLbPair2(s,n,i,r,f,new l(o),h),b=_.instructions[0]?.keys?.[1]?.pubkey;if(!b)throw new Error("Failed to extract pool address from transaction");return{transaction:_,poolAddress:b}}async addBuybackLiquidity(s,n,i,r,o,u){const m=await this.loadDLMM(),y=await this.loadBN(),l=await this.loadKeypair(),h=u?{cluster:u}:void 0,f=await m.create(s,i,h),_=l.generate(),b=o-1,g=o;return{transaction:await f.initializePositionAndAddLiquidityByStrategy({positionPubKey:_.publicKey,totalXAmount:new y(0),totalYAmount:new y(r),strategy:{maxBinId:g,minBinId:b,strategyType:Xe},user:n,slippage:1}),positionKeypair:_}}async getPoolStatus(s,n,i){const r=await this.loadDLMM(),o=i?{cluster:i}:void 0,u=await r.create(s,n,o),m=await u.getActiveBin();return{address:n.toBase58(),activeBinId:m.binId,activeBinPrice:m.price,binStep:u.lbPair.binStep}}}const W=6,ie=1,Qe="https://solscan.io/account",et="https://app.meteora.ag/dlmm";function tt({serverUrl:t,authManager:s,mintConfigured:n,mintAddress:i,tokenDecimals:r=2}){const[o,u]=d.useState({liquidityPoolAddress:null,buybackRateBps:null,rpcUrl:null,usdcMint:null,usdcAmount:null,deployedAt:null}),[m,y]=d.useState(!0),[l,h]=d.useState(80),[f,_]=d.useState(250),[b,g]=d.useState("idle"),[j,k]=d.useState(null),[p,C]=d.useState(null),[w,a]=d.useState(null),S=d.useRef(new Ze),A=d.useCallback(async()=>{try{const z=new re.ConfigApiClient(t,void 0,s),[R,F]=await Promise.all([z.getConfig("gift_cards"),z.getConfig("x402")]),B=R.config??{},P=F.config??{},M=B.liquidity_pool_address||null;u({liquidityPoolAddress:M,buybackRateBps:B.buyback_rate_bps!=null?Number(B.buyback_rate_bps):null,rpcUrl:P.rpc_url||null,usdcMint:P.token_mint||null,usdcAmount:B.liquidity_usdc_amount!=null?Number(B.liquidity_usdc_amount):null,deployedAt:B.liquidity_deployed_at||null}),M&&C(M),B.buyback_rate_bps!=null&&h(Number(B.buyback_rate_bps)/100)}catch{}finally{y(!1)}},[t,s]);d.useEffect(()=>{A()},[A]);const T=typeof window<"u"&&!!window.solana?.publicKey,c=!!o.rpcUrl,x=!!o.usdcMint,D=n&&T&&c&&x&&b==="idle",v=async z=>{if(!(!i||!o.rpcUrl||!o.usdcMint)){g(z),k(null),a(null);try{const{Connection:R,PublicKey:F,Keypair:B}=await import("@solana/web3.js"),P=new R(o.rpcUrl,"confirmed"),M=window.solana;if(!M?.publicKey||!M.signTransaction)throw new Error("Wallet not connected");const H=S.current,oe=new F(M.publicKey.toBase58()),je=l/100,ve=await H.computeBinId(je,r,W,ie);let L=p;if(z==="creating_pool"){const $=new F(i),Z=new F(o.usdcMint),G=await H.computeBinId(1,r,W,ie),{transaction:Q,poolAddress:ee}=await H.createPool(P,oe,$,Z,G,ie),te=await M.signTransaction(Q),se=await P.sendRawTransaction(te.serialize());await P.confirmTransaction(se,"confirmed"),L=ee.toBase58(),C(L)}if(z==="creating_pool"||z==="adding_liquidity"){if(g("adding_liquidity"),!L)throw new Error("Pool address not available");const $=new F(L),Z=Math.round(f*10**W),{transaction:G,positionKeypair:Q}=await H.addBuybackLiquidity(P,oe,$,Z,ve),ee=B.fromSecretKey(Q.secretKey);G.partialSign(ee);const te=await M.signTransaction(G),se=await P.sendRawTransaction(te.serialize());await P.confirmTransaction(se,"confirmed")}if(g("saving_config"),!L)throw new Error("Pool address not available");const _e=new re.ConfigApiClient(t,void 0,s),le=Math.round(l*100),de=Math.round(f*10**W),ce=new Date().toISOString();await _e.patchConfig("gift_cards",{liquidity_pool_address:L,buyback_rate_bps:le,liquidity_usdc_amount:de,liquidity_deployed_at:ce},"Meteora DLMM pool deployed for gift card buyback"),u($=>({...$,liquidityPoolAddress:L,buybackRateBps:le,usdcAmount:de,deployedAt:ce})),g("done")}catch(R){a(b==="idle"?z:b),k(R instanceof Error?R.message:"Deployment failed"),g("error")}}},N=()=>{D&&v("creating_pool")},K=()=>{!w||w==="idle"||w==="done"||w==="error"||v(w)};return m?e.jsx("div",{style:{padding:"2rem",textAlign:"center",opacity:.6},children:"Loading pool configuration..."}):o.liquidityPoolAddress?e.jsx(it,{poolAddress:o.liquidityPoolAddress,buybackRateBps:o.buybackRateBps,usdcAmount:o.usdcAmount,deployedAt:o.deployedAt}):b!=="idle"&&b!=="error"?e.jsx(nt,{step:b,poolAddress:p}):e.jsx(st,{buybackCents:l,setBuybackCents:h,usdcAmount:f,setUsdcAmount:_,mintConfigured:n,walletConnected:T,hasRpcUrl:c,hasUsdcMint:x,canDeploy:D,onDeploy:N,errorMessage:j,canRetry:!!w&&w!=="creating_pool",onRetry:K})}function st({buybackCents:t,setBuybackCents:s,usdcAmount:n,setUsdcAmount:i,mintConfigured:r,walletConnected:o,hasRpcUrl:u,hasUsdcMint:m,canDeploy:y,onDeploy:l,errorMessage:h,canRetry:f,onRetry:_}){const b=((100-t)/100).toFixed(2);return e.jsxs("div",{children:[e.jsx("h3",{className:"cedros-admin__section-title",style:{marginBottom:"0.5rem"},children:"Deploy Buyback Liquidity Pool"}),e.jsx("p",{style:{opacity:.7,marginBottom:"1rem",fontSize:14},children:"Create a Meteora DLMM pool to buy back gift card tokens at a discount. You earn the spread when tokens are resold at face value."}),e.jsxs("div",{className:"cedros-admin__form-row",children:[e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Buyback rate (cents per $1.00)"}),e.jsx("input",{type:"number",className:"cedros-admin__input",value:t,onChange:g=>s(Math.max(1,Math.min(99,parseInt(g.target.value)||80))),min:"1",max:"99"}),e.jsxs("div",{style:{marginTop:4,fontSize:12,opacity:.75},children:["You earn $",b," profit per gift card redeemed"]})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"USDC amount"}),e.jsx("input",{type:"number",className:"cedros-admin__input",value:n,onChange:g=>i(Math.max(1,parseFloat(g.target.value)||250)),min:"1",step:"1"}),e.jsx("div",{style:{marginTop:4,fontSize:12,opacity:.75},children:"Minimum recommended: $250"})]})]}),e.jsxs("div",{style:{margin:"1rem 0",display:"flex",flexDirection:"column",gap:6},children:[e.jsx(J,{label:"Token-22 mint initialized",met:r}),e.jsx(J,{label:"Wallet connected",met:o}),e.jsx(J,{label:"RPC URL configured",met:u}),e.jsx(J,{label:"USDC mint configured",met:m})]}),h&&e.jsx("div",{style:{padding:"0.5rem 0.75rem",marginBottom:"0.75rem",borderRadius:6,background:"rgba(239,68,68,0.1)",color:"#dc2626",fontSize:13},children:h}),e.jsx("div",{style:{display:"flex",gap:"0.75rem",alignItems:"center"},children:f?e.jsx("button",{className:"cedros-admin__button cedros-admin__button--primary",onClick:_,children:"Retry (Resume from Failed Step)"}):e.jsx("button",{className:"cedros-admin__button cedros-admin__button--primary",onClick:l,disabled:!y,children:"Deploy Liquidity Pool"})})]})}const xe=[{key:"creating_pool",label:"Creating DLMM pool..."},{key:"adding_liquidity",label:"Depositing USDC liquidity..."},{key:"saving_config",label:"Saving configuration..."},{key:"done",label:"Complete"}];function nt({step:t,poolAddress:s}){return e.jsxs("div",{children:[e.jsx("h3",{className:"cedros-admin__section-title",style:{marginBottom:"1rem"},children:"Deploying Pool..."}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:xe.map((n,i)=>{const r=xe.findIndex(y=>y.key===t),o=i,u=o<r||t==="done",m=o===r&&t!=="done";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:14},children:[e.jsx("span",{style:{width:20,textAlign:"center",fontWeight:600},children:u?"✓":m?"▶":"○"}),e.jsx("span",{style:{opacity:u||m?1:.4},children:n.label})]},n.key)})}),s&&e.jsxs("div",{style:{marginTop:"1rem",fontSize:13,opacity:.7},children:["Pool: ",e.jsx("code",{style:{fontSize:12},children:s})]})]})}function it({poolAddress:t,buybackRateBps:s,usdcAmount:n,deployedAt:i}){const r=s!=null?`$${(s/1e4).toFixed(2)}`:"Unknown",o=n!=null?`$${(n/10**W).toFixed(2)}`:null,u=i?new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):null,m=t.length>16?`${t.slice(0,8)}...${t.slice(-8)}`:t;return e.jsxs("div",{children:[e.jsx("h3",{className:"cedros-admin__section-title",style:{marginBottom:"1rem"},children:"Liquidity Pool Active"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0.75rem",maxWidth:600},children:[e.jsx("div",{style:{fontWeight:500,fontSize:13},children:"Pool Address"}),e.jsxs("div",{style:{fontSize:13,fontFamily:"monospace",wordBreak:"break-all"},children:[m,e.jsxs("span",{style:{marginLeft:8,display:"inline-flex",gap:6},children:[e.jsx(rt,{text:t}),e.jsx(fe,{href:`${Qe}/${t}`,label:"Solscan"}),e.jsx(fe,{href:`${et}/${t}`,label:"Meteora"})]})]}),e.jsx("div",{style:{fontWeight:500,fontSize:13},children:"Buyback Rate"}),e.jsxs("div",{style:{fontSize:13},children:[r," per $1.00"]}),o&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{fontWeight:500,fontSize:13},children:"USDC Deposited"}),e.jsx("div",{style:{fontSize:13},children:o})]}),u&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{fontWeight:500,fontSize:13},children:"Deployed"}),e.jsx("div",{style:{fontSize:13},children:u})]})]})]})}function J({label:t,met:s}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13},children:[e.jsx("span",{style:{color:s?"#16a34a":"#dc2626",fontWeight:600},children:s?"✓":"✗"}),e.jsx("span",{style:{opacity:s?.8:.5},children:t})]})}function rt({text:t}){const[s,n]=d.useState(!1),i=()=>{navigator.clipboard.writeText(t).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})};return e.jsx("button",{type:"button",onClick:i,style:{background:"none",border:"none",cursor:"pointer",fontSize:12,opacity:.7,padding:0},children:s?"Copied":"Copy"})}function fe({href:t,label:s}){return e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,opacity:.7},children:s})}function at({serverUrl:t,apiKey:s,authManager:n}){const[i,r]=d.useState(null),[o,u]=d.useState([]),[m,y]=d.useState(!0),[l,h]=d.useState(null),[f,_]=d.useState("mint"),[b,g]=d.useState({treasuryAddress:"",tokenSymbol:"storeUSD",tokenDecimals:2,transferFeeBps:250,maxTransferFee:500}),[j,k]=d.useState(!1),[p,C]=d.useState(!1),[w,a]=d.useState(null),S=d.useCallback(async(v,N)=>{if(n?.isAuthenticated())return n.fetchWithAuth(v,N);const K={"Content-Type":"application/json"};s&&(K["X-API-Key"]=s);const z=await fetch(`${t}${v}`,{...N,headers:{...K,...N?.headers}});if(!z.ok){const R=await z.text().catch(()=>`HTTP ${z.status}`);throw new Error(R)}return z.json()},[t,s,n]),A=d.useCallback(async()=>{try{h(null);const v=await S("/admin/token22/status");r(v)}catch{h("Failed to load Token-22 status")}finally{y(!1)}},[S]),T=d.useCallback(async()=>{try{const v=await S("/admin/gift-card-redemptions?limit=50");u(v.redemptions||[])}catch{u([])}},[S]);d.useEffect(()=>{A(),T()},[A,T]);const c=async v=>{if(v.preventDefault(),!!b.treasuryAddress){k(!0),a(null);try{const N=await S("/admin/token22/initialize",{method:"POST",body:JSON.stringify({treasuryAddress:b.treasuryAddress,tokenSymbol:b.tokenSymbol,tokenDecimals:b.tokenDecimals,transferFeeBps:b.transferFeeBps,maxTransferFee:b.maxTransferFee})});a(`Mint created: ${N.mintAddress}`),A()}catch(N){a(`Error: ${N instanceof Error?N.message:"Failed to initialize"}`)}finally{k(!1)}}},x=async()=>{C(!0),a(null);try{const v=await S("/admin/token22/harvest-fees",{method:"POST"});a(v.message)}catch(v){a(`Error: ${v instanceof Error?v.message:"Failed to harvest"}`)}finally{C(!1)}},D=v=>{try{return new Date(v).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return v}};return e.jsxs("div",{className:"cedros-admin__page",children:[e.jsx(pe.ErrorBanner,{message:l,onRetry:A}),e.jsx("div",{style:{display:"flex",gap:0,borderBottom:"1px solid rgba(0,0,0,0.1)",marginBottom:"1rem"},children:["mint","redemptions","compliance","liquidity","asset-classes","asset-redemptions"].map(v=>{const N={mint:"Token-22 Mint",redemptions:"Gift Card Redemptions",compliance:"Compliance",liquidity:"Liquidity","asset-classes":"Asset Classes","asset-redemptions":"Asset Redemptions"};return e.jsx("button",{type:"button",onClick:()=>_(v),style:{padding:"0.5rem 1rem",background:"none",border:"none",borderBottom:f===v?"2px solid currentColor":"2px solid transparent",fontWeight:f===v?600:400,cursor:"pointer",opacity:f===v?1:.6},children:N[v]},v)})}),m?e.jsxs("div",{className:"cedros-admin__loading",children:[pe.Icons.loading," Loading..."]}):f==="mint"?e.jsx(ot,{mintStatus:i,initForm:b,setInitForm:g,isInitializing:j,isHarvesting:p,actionMessage:w,onInitialize:c,onHarvestFees:x,formatDate:D}):f==="redemptions"?e.jsx(lt,{redemptions:o,formatDate:D}):f==="compliance"?e.jsx(Ye,{serverUrl:t,apiKey:s,authManager:n}):f==="liquidity"?e.jsx(tt,{serverUrl:t,authManager:n,mintConfigured:!!i?.configured,mintAddress:i?.mintAddress,tokenDecimals:i?.tokenDecimals}):f==="asset-classes"?e.jsx(Re,{serverUrl:t,apiKey:s,authManager:n,onNavigateToLiquidity:()=>_("liquidity")}):e.jsx(qe,{serverUrl:t,apiKey:s,authManager:n})]})}function ot({mintStatus:t,initForm:s,setInitForm:n,isInitializing:i,isHarvesting:r,actionMessage:o,onInitialize:u,onHarvestFees:m,formatDate:y}){return t?.configured?e.jsxs("div",{children:[e.jsx("h3",{className:"cedros-admin__section-title",style:{marginBottom:"1rem"},children:"Token-22 Mint Status"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0.75rem",maxWidth:600},children:[e.jsx(I,{label:"Mint Address",value:t.mintAddress,mono:!0}),e.jsx(I,{label:"Token Symbol",value:t.tokenSymbol}),e.jsx(I,{label:"Decimals",value:String(t.tokenDecimals)}),e.jsx(I,{label:"Transfer Fee",value:`${t.transferFeeBps} bps (${((t.transferFeeBps??0)/100).toFixed(2)}%)`}),e.jsx(I,{label:"Max Transfer Fee",value:String(t.maxTransferFee)}),e.jsx(I,{label:"Treasury",value:t.treasuryAddress,mono:!0}),e.jsx(I,{label:"Authority",value:t.mintAuthority,mono:!0}),e.jsx(I,{label:"Created",value:t.createdAt?y(t.createdAt):"—"})]}),e.jsxs("div",{style:{marginTop:"1.5rem",display:"flex",gap:"0.75rem",alignItems:"center"},children:[e.jsx("button",{className:"cedros-admin__button cedros-admin__button--primary",onClick:m,disabled:r,children:r?"Harvesting...":"Harvest Transfer Fees"}),o&&e.jsx("span",{style:{fontSize:13,opacity:.8},children:o})]})]}):e.jsxs("div",{children:[e.jsx("h3",{className:"cedros-admin__section-title",style:{marginBottom:"0.5rem"},children:"Initialize Token-22 Mint"}),e.jsx("p",{style:{opacity:.7,marginBottom:"1rem",fontSize:14},children:"Create a Token-22 mint with transfer fee extension for the secondary market. This is a one-time operation per tenant."}),e.jsxs("form",{onSubmit:u,children:[e.jsxs("div",{className:"cedros-admin__form-row",children:[e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Treasury address (Solana)"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:s.treasuryAddress,onChange:l=>n(h=>({...h,treasuryAddress:l.target.value})),placeholder:"e.g., 7xKX...",required:!0})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Token symbol"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:s.tokenSymbol,onChange:l=>n(h=>({...h,tokenSymbol:l.target.value})),placeholder:"storeUSD"})]})]}),e.jsxs("div",{className:"cedros-admin__form-row",children:[e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Token decimals"}),e.jsx("input",{type:"number",className:"cedros-admin__input",value:s.tokenDecimals,onChange:l=>n(h=>({...h,tokenDecimals:parseInt(l.target.value)||2})),min:"0",max:"9"})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Transfer fee (basis points)"}),e.jsx("input",{type:"number",className:"cedros-admin__input",value:s.transferFeeBps,onChange:l=>n(h=>({...h,transferFeeBps:parseInt(l.target.value)||0})),min:"0",max:"10000"}),e.jsx("div",{style:{marginTop:4,fontSize:12,opacity:.75},children:"e.g., 250 = 2.5% fee on secondary market transfers"})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Max transfer fee (atomic)"}),e.jsx("input",{type:"number",className:"cedros-admin__input",value:s.maxTransferFee,onChange:l=>n(h=>({...h,maxTransferFee:parseInt(l.target.value)||0})),min:"0"})]})]}),e.jsxs("div",{className:"cedros-admin__form-actions",style:{marginTop:"1rem"},children:[e.jsx("button",{type:"submit",className:"cedros-admin__button cedros-admin__button--primary",disabled:i,children:i?"Creating Mint...":"Initialize Mint"}),o&&e.jsx("span",{style:{marginLeft:"0.75rem",fontSize:13,opacity:.8},children:o})]})]})]})}function I({label:t,value:s,mono:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{fontWeight:500,fontSize:13},children:t}),e.jsx("div",{style:{fontSize:13,fontFamily:n?"monospace":"inherit",wordBreak:n?"break-all":"normal",opacity:s?1:.5},children:s||"—"})]})}function lt({redemptions:t,formatDate:s}){return t.length?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:"Date"}),e.jsx("th",{children:"Order"}),e.jsx("th",{children:"Product"}),e.jsx("th",{children:"Buyer"}),e.jsx("th",{children:"Recipient"}),e.jsx("th",{children:"Value"}),e.jsx("th",{children:"Token Minted"})]})}),e.jsx("tbody",{children:t.map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:{whiteSpace:"nowrap"},children:s(n.createdAt)}),e.jsx("td",{children:e.jsxs("code",{style:{fontSize:12},children:[n.orderId.slice(0,8),"..."]})}),e.jsx("td",{children:e.jsx("code",{style:{fontSize:12},children:n.productId})}),e.jsx("td",{children:e.jsxs("code",{style:{fontSize:12},children:[n.buyerUserId.slice(0,8),"..."]})}),e.jsx("td",{children:e.jsxs("code",{style:{fontSize:12},children:[n.recipientUserId.slice(0,8),"..."]})}),e.jsxs("td",{children:["$",(n.faceValueCents/100).toFixed(2)," ",n.currency.toUpperCase()]}),e.jsx("td",{children:e.jsx("span",{className:`cedros-admin__badge ${n.tokenMinted?"cedros-admin__badge--success":"cedros-admin__badge--muted"}`,children:n.tokenMinted?"Yes":"No"})})]},n.id))})]})}):e.jsx("div",{style:{padding:"2rem",textAlign:"center",opacity:.6},children:"No gift card redemptions yet."})}exports.Token22Section=at;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@solana/web3.js"),w=require("@solana/spl-token"),t=require("./CedrosContext-D-lnoEkR.js"),h=require("./index-WcOlBYZJ.js");class p{connection;cluster;endpoint;allowUnknownMint;rpcRateLimiter=t.createRateLimiter({maxRequests:50,windowMs:6e4});rpcCircuitBreaker=t.createCircuitBreaker({failureThreshold:5,timeout:1e4,name:"solana-rpc"});constructor(r="mainnet-beta",e,n=!1){this.cluster=r,this.endpoint=e,this.allowUnknownMint=n,this.connection=this.createConnection()}createConnection(){const r=this.endpoint??o.clusterApiUrl(this.cluster);return new o.Connection(r,"confirmed")}transformRpcError(r){const e=r instanceof Error?r.message:typeof r=="string"?r:String(r);return e.includes("403")||e.includes("Access forbidden")?new Error("Public Solana RPC access denied. Please configure a custom RPC endpoint (e.g., from Helius, QuickNode, or Alchemy) in your CedrosProvider config using the solanaEndpoint option."):e.includes("429")||e.includes("Too Many Requests")?new Error("Solana RPC rate limit exceeded. Please configure a custom RPC endpoint with higher limits in your CedrosProvider config using the solanaEndpoint option."):r instanceof Error?r:new Error(e)}async buildTransaction(r){const{requirement:e,payerPublicKey:n,blockhash:a}=r;if(!e||!e.payTo)throw new Error("Invalid requirement: missing payTo");t.getLogger().debug("[WalletManager] Building transaction for resource:",e.resource);const i=new o.Transaction,u=this.resolveAmountInMinorUnits(e),c=e.asset;if(!c)throw new Error("asset is required in x402 requirement");const l=t.validateX402Asset(c,e.resource,this.allowUnknownMint);if(!l.isValid&&l.error)throw new Error(l.error);l.warning&&t.getLogger().warn(l.warning);const y=new o.PublicKey(c),m=await w.getAssociatedTokenAddress(y,n);if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");let d;try{d=await this.rpcCircuitBreaker.execute(async()=>await t.retryWithBackoff(async()=>await this.connection.getAccountInfo(m),{...t.RETRY_PRESETS.QUICK,name:"rpc-get-account-info"}))}catch(s){throw s instanceof t.CircuitBreakerOpenError?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(s)}if(!d)throw new Error("Payer is missing an associated token account for this mint");let f;try{f=e.extra?.recipientTokenAccount?new o.PublicKey(e.extra.recipientTokenAccount):new o.PublicKey(e.payTo)}catch(s){throw t.getLogger().warn("[WalletManager] Failed to resolve recipient address:",s),new Error("We are currently unable to process payment, please try again later")}if(i.add(w.createTransferInstruction(m,f,n,u)),e.extra?.memo){const s=new o.TransactionInstruction({keys:[],programId:new o.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),data:Buffer.from(e.extra.memo,"utf8")});i.add(s)}let g;if(a)g=a;else{if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");try{g=(await this.rpcCircuitBreaker.execute(async()=>await t.retryWithBackoff(async()=>await this.connection.getLatestBlockhash(),{...t.RETRY_PRESETS.QUICK,name:"rpc-get-blockhash"}))).blockhash}catch(s){throw s instanceof t.CircuitBreakerOpenError?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(s)}}return i.recentBlockhash=g,e.extra?.feePayer?i.feePayer=new o.PublicKey(e.extra.feePayer):i.feePayer=n,i}resolveAmountInMinorUnits(r){const e=r.maxAmountRequired;if(!/^\d+$/.test(e))throw new Error("Invalid maxAmountRequired in requirement: must be a non-negative integer string");const n=BigInt(e);if(n<=0n)throw new Error("Invalid maxAmountRequired in requirement");return n}buildPaymentPayload(r){const{requirement:e,signedTx:n,payerPublicKey:a}=r;return{x402Version:0,scheme:e.scheme,network:e.network,payload:{signature:n.signature,transaction:n.serialized,payer:a.toString(),memo:e.extra?.memo,recipientTokenAccount:e.extra?.recipientTokenAccount}}}async signTransaction(r){const{transaction:e,signTransaction:n}=r;t.getLogger().debug("[WalletManager] Requesting wallet to sign transaction");const a=await n(e),i=a.serialize(),u=a.signatures[0]?.signature;if(!u)throw new Error("Signed transaction missing signature");const c=h.bs58.encode(u);return t.getLogger().debug("[WalletManager] Transaction signed with signature:",c.substring(0,20)+"..."),{serialized:t.gBase64.fromUint8Array(i),signature:c}}deserializeTransaction(r){try{const e=t.gBase64.toUint8Array(r);return o.Transaction.from(e)}catch(e){throw new Error(`Failed to deserialize transaction: ${t.formatError(e,"Unknown error")}`)}}async partiallySignTransaction(r){const{transaction:e,signTransaction:n,blockhash:a}=r;a&&e.recentBlockhash!==a&&(e.recentBlockhash=a);const i=await n(e),u=i.signatures[0]?.signature;if(u){const l=h.bs58.encode(u);t.getLogger().debug("[WalletManager] Partially signed with signature:",l.substring(0,20)+"...")}const c=i.serialize({requireAllSignatures:!1,verifySignatures:!1});return t.gBase64.fromUint8Array(c)}async getBalance(r){if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");try{return await this.rpcCircuitBreaker.execute(async()=>await t.retryWithBackoff(async()=>await this.connection.getBalance(r),{...t.RETRY_PRESETS.QUICK,name:"rpc-get-balance"}))/o.LAMPORTS_PER_SOL}catch(e){throw e instanceof t.CircuitBreakerOpenError?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(e)}}async verifyTransaction(r){if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded for transaction verification");try{return!!(await this.rpcCircuitBreaker.execute(async()=>await t.retryWithBackoff(async()=>await this.connection.getSignatureStatus(r),{...t.RETRY_PRESETS.QUICK,name:"rpc-verify-tx"}))).value?.confirmationStatus}catch(e){return e instanceof t.CircuitBreakerOpenError&&t.getLogger().warn("[WalletManager] Circuit breaker OPEN - cannot verify transaction"),!1}}}exports.WalletManager=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@solana/web3.js"),w=require("@solana/spl-token"),t=require("./CedrosContext-7dwmEeUY.js"),h=require("./index-WcOlBYZJ.js");class p{connection;cluster;endpoint;allowUnknownMint;rpcRateLimiter=t.createRateLimiter({maxRequests:50,windowMs:6e4});rpcCircuitBreaker=t.createCircuitBreaker({failureThreshold:5,timeout:1e4,name:"solana-rpc"});constructor(r="mainnet-beta",e,n=!1){this.cluster=r,this.endpoint=e,this.allowUnknownMint=n,this.connection=this.createConnection()}createConnection(){const r=this.endpoint??o.clusterApiUrl(this.cluster);return new o.Connection(r,"confirmed")}transformRpcError(r){const e=r instanceof Error?r.message:typeof r=="string"?r:String(r);return e.includes("403")||e.includes("Access forbidden")?new Error("Public Solana RPC access denied. Please configure a custom RPC endpoint (e.g., from Helius, QuickNode, or Alchemy) in your CedrosProvider config using the solanaEndpoint option."):e.includes("429")||e.includes("Too Many Requests")?new Error("Solana RPC rate limit exceeded. Please configure a custom RPC endpoint with higher limits in your CedrosProvider config using the solanaEndpoint option."):r instanceof Error?r:new Error(e)}async buildTransaction(r){const{requirement:e,payerPublicKey:n,blockhash:a}=r;if(!e||!e.payTo)throw new Error("Invalid requirement: missing payTo");t.getLogger().debug("[WalletManager] Building transaction for resource:",e.resource);const i=new o.Transaction,u=this.resolveAmountInMinorUnits(e),c=e.asset;if(!c)throw new Error("asset is required in x402 requirement");const l=t.validateX402Asset(c,e.resource,this.allowUnknownMint);if(!l.isValid&&l.error)throw new Error(l.error);l.warning&&t.getLogger().warn(l.warning);const y=new o.PublicKey(c),m=await w.getAssociatedTokenAddress(y,n);if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");let d;try{d=await this.rpcCircuitBreaker.execute(async()=>await t.retryWithBackoff(async()=>await this.connection.getAccountInfo(m),{...t.RETRY_PRESETS.QUICK,name:"rpc-get-account-info"}))}catch(s){throw s instanceof t.CircuitBreakerOpenError?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(s)}if(!d)throw new Error("Payer is missing an associated token account for this mint");let f;try{f=e.extra?.recipientTokenAccount?new o.PublicKey(e.extra.recipientTokenAccount):new o.PublicKey(e.payTo)}catch(s){throw t.getLogger().warn("[WalletManager] Failed to resolve recipient address:",s),new Error("We are currently unable to process payment, please try again later")}if(i.add(w.createTransferInstruction(m,f,n,u)),e.extra?.memo){const s=new o.TransactionInstruction({keys:[],programId:new o.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),data:Buffer.from(e.extra.memo,"utf8")});i.add(s)}let g;if(a)g=a;else{if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");try{g=(await this.rpcCircuitBreaker.execute(async()=>await t.retryWithBackoff(async()=>await this.connection.getLatestBlockhash(),{...t.RETRY_PRESETS.QUICK,name:"rpc-get-blockhash"}))).blockhash}catch(s){throw s instanceof t.CircuitBreakerOpenError?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(s)}}return i.recentBlockhash=g,e.extra?.feePayer?i.feePayer=new o.PublicKey(e.extra.feePayer):i.feePayer=n,i}resolveAmountInMinorUnits(r){const e=r.maxAmountRequired;if(!/^\d+$/.test(e))throw new Error("Invalid maxAmountRequired in requirement: must be a non-negative integer string");const n=BigInt(e);if(n<=0n)throw new Error("Invalid maxAmountRequired in requirement");return n}buildPaymentPayload(r){const{requirement:e,signedTx:n,payerPublicKey:a}=r;return{x402Version:0,scheme:e.scheme,network:e.network,payload:{signature:n.signature,transaction:n.serialized,payer:a.toString(),memo:e.extra?.memo,recipientTokenAccount:e.extra?.recipientTokenAccount}}}async signTransaction(r){const{transaction:e,signTransaction:n}=r;t.getLogger().debug("[WalletManager] Requesting wallet to sign transaction");const a=await n(e),i=a.serialize(),u=a.signatures[0]?.signature;if(!u)throw new Error("Signed transaction missing signature");const c=h.bs58.encode(u);return t.getLogger().debug("[WalletManager] Transaction signed with signature:",c.substring(0,20)+"..."),{serialized:t.gBase64.fromUint8Array(i),signature:c}}deserializeTransaction(r){try{const e=t.gBase64.toUint8Array(r);return o.Transaction.from(e)}catch(e){throw new Error(`Failed to deserialize transaction: ${t.formatError(e,"Unknown error")}`)}}async partiallySignTransaction(r){const{transaction:e,signTransaction:n,blockhash:a}=r;a&&e.recentBlockhash!==a&&(e.recentBlockhash=a);const i=await n(e),u=i.signatures[0]?.signature;if(u){const l=h.bs58.encode(u);t.getLogger().debug("[WalletManager] Partially signed with signature:",l.substring(0,20)+"...")}const c=i.serialize({requireAllSignatures:!1,verifySignatures:!1});return t.gBase64.fromUint8Array(c)}async getBalance(r){if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");try{return await this.rpcCircuitBreaker.execute(async()=>await t.retryWithBackoff(async()=>await this.connection.getBalance(r),{...t.RETRY_PRESETS.QUICK,name:"rpc-get-balance"}))/o.LAMPORTS_PER_SOL}catch(e){throw e instanceof t.CircuitBreakerOpenError?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(e)}}async verifyTransaction(r){if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded for transaction verification");try{return!!(await this.rpcCircuitBreaker.execute(async()=>await t.retryWithBackoff(async()=>await this.connection.getSignatureStatus(r),{...t.RETRY_PRESETS.QUICK,name:"rpc-verify-tx"}))).value?.confirmationStatus}catch(e){return e instanceof t.CircuitBreakerOpenError&&t.getLogger().warn("[WalletManager] Circuit breaker OPEN - cannot verify transaction"),!1}}}exports.WalletManager=p;
@@ -1,6 +1,6 @@
1
1
  import { clusterApiUrl as C, Connection as b, Transaction as P, PublicKey as l, TransactionInstruction as R, LAMPORTS_PER_SOL as x } from "@solana/web3.js";
2
2
  import { getAssociatedTokenAddress as T, createTransferInstruction as A } from "@solana/spl-token";
3
- import { c as v, b as B, i as u, k as S, r as m, g, e as w, l as f, m as M } from "./CedrosContext-BE6P5PQ0.mjs";
3
+ import { c as v, b as B, i as u, k as S, r as m, g, e as w, l as f, m as M } from "./CedrosContext-BlArEF7k.mjs";
4
4
  import { b as k } from "./index-BFt38o8Q.mjs";
5
5
  class z {
6
6
  connection;