@cedros/pay-react 1.1.20 → 1.1.22

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 (42) hide show
  1. package/README.md +2 -0
  2. package/dist/{AISettingsSection-f5K0nUoQ.js → AISettingsSection-BtOxEweU.js} +1 -1
  3. package/dist/{AISettingsSection-BH-RXvk1.mjs → AISettingsSection-p3iikbSw.mjs} +2 -2
  4. package/dist/{AutosaveIndicator-CpTVtJIz.js → AutosaveIndicator-C-CH-obR.js} +1 -1
  5. package/dist/{AutosaveIndicator-DTOaopUP.mjs → AutosaveIndicator-CWbb-VXf.mjs} +1 -1
  6. package/dist/{FAQSection-CVJ5w6cB.js → FAQSection-DQpF7hVx.js} +1 -1
  7. package/dist/{FAQSection-BO7ZfQMN.mjs → FAQSection-byh7zfqI.mjs} +1 -1
  8. package/dist/MessagingSection-B6EHvjDw.js +1 -0
  9. package/dist/{MessagingSection-CmFYFdaw.mjs → MessagingSection-CK208brx.mjs} +143 -96
  10. package/dist/{PaymentSettingsSection-VDcgpOkp.mjs → PaymentSettingsSection-B9H253x1.mjs} +1 -1
  11. package/dist/{PaymentSettingsSection-BKDiep-C.js → PaymentSettingsSection-Cmmuhmd4.js} +1 -1
  12. package/dist/{SettingsSection-B0TpaIOG.mjs → SettingsSection-DDLMaEPo.mjs} +1 -1
  13. package/dist/{SettingsSection-DSlW47o4.js → SettingsSection-DrzGdvHH.js} +1 -1
  14. package/dist/{SingleCategorySettings-Cwlehl0u.mjs → SingleCategorySettings-BU98SRFV.mjs} +19 -15
  15. package/dist/SingleCategorySettings-DqcXe-q4.js +3 -0
  16. package/dist/{StorefrontSection-DfN5yxkV.js → StorefrontSection-DTpZ_GgO.js} +1 -1
  17. package/dist/{StorefrontSection-BAY9V1j6.mjs → StorefrontSection-Dr2ciBVg.mjs} +2 -2
  18. package/dist/{SubscriptionsSection-D_RKCILr.mjs → SubscriptionsSection-CU3Ce8r9.mjs} +1 -1
  19. package/dist/{SubscriptionsSection-BboudRYv.js → SubscriptionsSection-CYJpArJ8.js} +1 -1
  20. package/dist/crypto-only.js +1 -1
  21. package/dist/crypto-only.mjs +133 -130
  22. package/dist/{index-75RhiLDq.mjs → index-CufXF9Yd.mjs} +3116 -3099
  23. package/dist/{index-B5ck27xb.js → index-IZ4WcMd7.js} +10 -10
  24. package/dist/index.js +1 -1
  25. package/dist/index.mjs +51 -48
  26. package/dist/sections-Bc6ARlND.mjs +8 -0
  27. package/dist/{sections-BCdzdqlG.js → sections-CR7NRsjq.js} +1 -1
  28. package/dist/src/admin/index.d.ts +2 -0
  29. package/dist/src/admin/index.d.ts.map +1 -1
  30. package/dist/src/admin/sectionIds.d.ts +43 -0
  31. package/dist/src/admin/sectionIds.d.ts.map +1 -0
  32. package/dist/src/components/admin/MessagingSection.d.ts.map +1 -1
  33. package/dist/src/components/admin/configApi.d.ts.map +1 -1
  34. package/dist/src/components/admin/emailProviders.d.ts +18 -0
  35. package/dist/src/components/admin/emailProviders.d.ts.map +1 -0
  36. package/dist/src/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -1
  37. package/dist/src/index.d.ts +1 -1
  38. package/dist/src/index.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/dist/MessagingSection-CRFtSoE8.js +0 -1
  41. package/dist/SingleCategorySettings-BTXR7zex.js +0 -3
  42. package/dist/sections-BIBMX6KS.mjs +0 -8
package/README.md CHANGED
@@ -1535,6 +1535,8 @@ Sections are addressed using the format `pluginId:sectionId`:
1535
1535
 
1536
1536
  See the [cedros-login documentation](https://github.com/cedros-dev/cedros-login) for full `AdminShell` API reference and custom plugin creation.
1537
1537
 
1538
+ > **Integration contract:** For complete embedding requirements (host context, section allowlists, route prefixes, auth troubleshooting), see [docs/admin-embedding-contract.md](./docs/admin-embedding-contract.md).
1539
+
1538
1540
  ---
1539
1541
 
1540
1542
  ## Props Reference
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),b=require("./index-B5ck27xb.js"),z=require("./AutosaveIndicator-CpTVtJIz.js"),w=[{id:"not_set",label:"Disabled",provider:null},{id:"gemini-2.5-flash",label:"Gemini 2.5 Flash",provider:"gemini"},{id:"gemini-2.5-pro",label:"Gemini 2.5 Pro",provider:"gemini"},{id:"openai-4o",label:"OpenAI 4o",provider:"openai"},{id:"openai-5.1",label:"OpenAI 5.1",provider:"openai"},{id:"openai-5.2",label:"OpenAI 5.2",provider:"openai"}],P=[{task:"site_chat",label:"Site Chat",description:"The conversational model that crafts responses to customer messages",defaultPrompt:`You are a friendly and helpful shopping assistant for our store. Your role is to:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),b=require("./index-IZ4WcMd7.js"),z=require("./AutosaveIndicator-C-CH-obR.js"),w=[{id:"not_set",label:"Disabled",provider:null},{id:"gemini-2.5-flash",label:"Gemini 2.5 Flash",provider:"gemini"},{id:"gemini-2.5-pro",label:"Gemini 2.5 Pro",provider:"gemini"},{id:"openai-4o",label:"OpenAI 4o",provider:"openai"},{id:"openai-5.1",label:"OpenAI 5.1",provider:"openai"},{id:"openai-5.2",label:"OpenAI 5.2",provider:"openai"}],P=[{task:"site_chat",label:"Site Chat",description:"The conversational model that crafts responses to customer messages",defaultPrompt:`You are a friendly and helpful shopping assistant for our store. Your role is to:
2
2
 
3
3
  - Help customers find products that match their needs
4
4
  - Answer questions about products, shipping, returns, and store policies
@@ -1,7 +1,7 @@
1
1
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
2
2
  import { useState as u, useRef as S, useCallback as A, useEffect as T, useMemo as q } from "react";
3
- import { I as w, E as J, F as Y } from "./index-75RhiLDq.mjs";
4
- import { A as X } from "./AutosaveIndicator-DTOaopUP.mjs";
3
+ import { I as w, E as J, F as Y } from "./index-CufXF9Yd.mjs";
4
+ import { A as X } from "./AutosaveIndicator-CWbb-VXf.mjs";
5
5
  const C = [
6
6
  { id: "not_set", label: "Disabled", provider: null },
7
7
  { id: "gemini-2.5-flash", label: "Gemini 2.5 Flash", provider: "gemini" },
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),i=require("./index-B5ck27xb.js");function a({status:n,error:r}){return n==="idle"?null:e.jsxs("span",{className:`cedros-admin__autosave-indicator cedros-admin__autosave-indicator--${n}`,style:{display:"inline-flex",alignItems:"center",gap:"0.375rem",fontSize:"0.8125rem",color:n==="error"?"var(--cedros-admin-error, #ef4444)":"var(--cedros-admin-text-muted, #64748b)"},children:[n==="pending"&&e.jsx("span",{style:{opacity:.7},children:"Unsaved changes"}),n==="saving"&&e.jsxs(e.Fragment,{children:[i.Icons.loading,e.jsx("span",{children:"Saving..."})]}),n==="saved"&&e.jsxs(e.Fragment,{children:[i.Icons.check,e.jsx("span",{style:{color:"var(--cedros-admin-success, #22c55e)"},children:"Saved"})]}),n==="error"&&e.jsxs("span",{children:["Save failed",r?`: ${r}`:""]})]})}exports.AutosaveIndicator=a;
1
+ "use strict";const e=require("react/jsx-runtime"),i=require("./index-IZ4WcMd7.js");function a({status:n,error:r}){return n==="idle"?null:e.jsxs("span",{className:`cedros-admin__autosave-indicator cedros-admin__autosave-indicator--${n}`,style:{display:"inline-flex",alignItems:"center",gap:"0.375rem",fontSize:"0.8125rem",color:n==="error"?"var(--cedros-admin-error, #ef4444)":"var(--cedros-admin-text-muted, #64748b)"},children:[n==="pending"&&e.jsx("span",{style:{opacity:.7},children:"Unsaved changes"}),n==="saving"&&e.jsxs(e.Fragment,{children:[i.Icons.loading,e.jsx("span",{children:"Saving..."})]}),n==="saved"&&e.jsxs(e.Fragment,{children:[i.Icons.check,e.jsx("span",{style:{color:"var(--cedros-admin-success, #22c55e)"},children:"Saved"})]}),n==="error"&&e.jsxs("span",{children:["Save failed",r?`: ${r}`:""]})]})}exports.AutosaveIndicator=a;
@@ -1,5 +1,5 @@
1
1
  import { jsxs as n, jsx as r, Fragment as i } from "react/jsx-runtime";
2
- import { I as d } from "./index-75RhiLDq.mjs";
2
+ import { I as d } from "./index-CufXF9Yd.mjs";
3
3
  function l({ status: e, error: a }) {
4
4
  return e === "idle" ? null : /* @__PURE__ */ n(
5
5
  "span",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),d=require("./index-B5ck27xb.js");function R({serverUrl:h,apiKey:o,pageSize:g=20,authManager:r}){const[u,N]=c.useState([]),[Q,w]=c.useState(!0),[S,f]=c.useState(!1),[p,A]=c.useState(null),[F,C]=c.useState(!1),[x,P]=c.useState(""),[v,O]=c.useState("all"),[q,b]=c.useState(null),[$,j]=c.useState(null),[n,l]=c.useState({question:"",answer:"",keywordsCsv:"",active:!0,useInChat:!0,displayOnPage:!0}),_=c.useCallback(async()=>{w(!0);try{j(null);let s;const t=`/admin/faqs?limit=${g}`;if(r?.isAuthenticated())s=await r.fetchWithAuth(t);else{const i={"Content-Type":"application/json"};o&&(i["X-API-Key"]=o);const a=await fetch(`${h}${t}`,{headers:i});if(!a.ok)throw new Error(`Failed to fetch FAQs: ${a.status}`);s=await a.json()}N(s.faqs||[])}catch{N([]),j("Failed to load FAQs")}finally{w(!1)}},[h,o,g,r]);c.useEffect(()=>{_()},[_]);const E=async s=>{if(s.preventDefault(),!(!n.question.trim()||!n.answer.trim())){C(!0);try{const t=n.keywordsCsv.split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),i={question:n.question.trim(),answer:n.answer.trim(),keywords:t,active:n.active,useInChat:n.useInChat,displayOnPage:n.displayOnPage};if(p){const a=`/admin/faqs/${p.id}`;if(r?.isAuthenticated())await r.fetchWithAuth(a,{method:"PUT",body:JSON.stringify(i)});else{const m={"Content-Type":"application/json"};o&&(m["X-API-Key"]=o);const I=await fetch(`${h}${a}`,{method:"PUT",headers:m,body:JSON.stringify(i)});if(!I.ok)throw new Error(`Failed to update FAQ: ${I.status}`)}}else if(r?.isAuthenticated())await r.fetchWithAuth("/admin/faqs",{method:"POST",body:JSON.stringify(i)});else{const a={"Content-Type":"application/json"};o&&(a["X-API-Key"]=o);const m=await fetch(`${h}/admin/faqs`,{method:"POST",headers:a,body:JSON.stringify(i)});if(!m.ok)throw new Error(`Failed to create FAQ: ${m.status}`)}y(),_()}catch{j(p?"Failed to update FAQ":"Failed to create FAQ")}finally{C(!1)}}},T=async s=>{try{const t=`/admin/faqs/${s}`;if(r?.isAuthenticated())await r.fetchWithAuth(t,{method:"DELETE"});else{const i={"Content-Type":"application/json"};o&&(i["X-API-Key"]=o);const a=await fetch(`${h}${t}`,{method:"DELETE",headers:i});if(!a.ok)throw new Error(`Failed to delete FAQ: ${a.status}`)}_()}catch{j("Failed to delete FAQ")}b(null)},D=async s=>{try{const t=`/admin/faqs/${s.id}`,i={...s,active:!s.active};if(r?.isAuthenticated())await r.fetchWithAuth(t,{method:"PUT",body:JSON.stringify(i)});else{const a={"Content-Type":"application/json"};o&&(a["X-API-Key"]=o);const m=await fetch(`${h}${t}`,{method:"PUT",headers:a,body:JSON.stringify(i)});if(!m.ok)throw new Error(`Failed to update FAQ: ${m.status}`)}_()}catch{j("Failed to update FAQ status")}},y=()=>{l({question:"",answer:"",keywordsCsv:"",active:!0,useInChat:!0,displayOnPage:!0}),A(null),f(!1)},L=s=>{l({question:s.question,answer:s.answer,keywordsCsv:s.keywords.join(", "),active:s.active,useInChat:s.useInChat??!0,displayOnPage:s.displayOnPage??!0}),A(s),f(!0)},W=u.length,B=u.filter(s=>s.active).length,J=u.filter(s=>s.active&&s.useInChat).length,X=u.filter(s=>s.active&&s.displayOnPage).length,k=c.useMemo(()=>u.filter(s=>{if(v==="active"&&!s.active||v==="inactive"&&s.active)return!1;if(x){const t=x.toLowerCase();return s.question.toLowerCase().includes(t)||s.answer.toLowerCase().includes(t)||s.keywords.some(i=>i.includes(t))}return!0}),[u,v,x]);return e.jsxs("div",{className:"cedros-admin__faqs",children:[e.jsx(d.ErrorBanner,{message:$,onRetry:_}),e.jsx(d.StatsBar,{stats:[{label:"Total FAQs",value:W},{label:"Active",value:B,variant:"success"},{label:"In Chat",value:J},{label:"On Page",value:X}]}),e.jsxs("div",{className:"cedros-admin__section",children:[e.jsxs("div",{className:"cedros-admin__section-header",children:[e.jsxs("div",{className:"cedros-admin__section-header-left",children:[e.jsx("h3",{className:"cedros-admin__section-title",children:"Knowledge Base"}),e.jsx("p",{className:"cedros-admin__section-subtitle",children:"Manage FAQs for the AI chat assistant and public FAQ page."})]}),e.jsx("div",{className:"cedros-admin__section-header-right",children:e.jsxs("button",{className:"cedros-admin__button cedros-admin__button--primary",onClick:()=>{y(),f(!0)},children:[d.Icons.plus," Add FAQ"]})})]}),e.jsxs("div",{className:"cedros-admin__filters",style:{display:"flex",gap:"1rem",marginBottom:"1rem"},children:[e.jsx("input",{type:"text",placeholder:"Search FAQs...",value:x,onChange:s=>P(s.target.value),className:"cedros-admin__input",style:{flex:1,maxWidth:300}}),e.jsxs("select",{value:v,onChange:s=>O(s.target.value),className:"cedros-admin__select",children:[e.jsx("option",{value:"all",children:"All Status"}),e.jsx("option",{value:"active",children:"Active Only"}),e.jsx("option",{value:"inactive",children:"Inactive Only"})]})]}),S&&e.jsx("div",{className:"cedros-admin__form-container",style:{marginBottom:"1.5rem"},children:e.jsxs("form",{onSubmit:E,className:"cedros-admin__form",children:[e.jsxs("div",{className:"cedros-admin__form-header",children:[e.jsx("h4",{children:p?"Edit FAQ":"Add New FAQ"}),e.jsx("button",{type:"button",className:"cedros-admin__button--icon",onClick:y,children:d.Icons.close})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsx("label",{className:"cedros-admin__label",children:"Question *"}),e.jsx("input",{type:"text",value:n.question,onChange:s=>l(t=>({...t,question:s.target.value})),className:"cedros-admin__input",placeholder:"What is your return policy?",required:!0})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsx("label",{className:"cedros-admin__label",children:"Answer *"}),e.jsx("textarea",{value:n.answer,onChange:s=>l(t=>({...t,answer:s.target.value})),className:"cedros-admin__textarea",placeholder:"We accept returns within 30 days...",rows:4,required:!0}),e.jsx("span",{className:"cedros-admin__hint",children:"Supports markdown formatting."})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsx("label",{className:"cedros-admin__label",children:"Keywords"}),e.jsx("input",{type:"text",value:n.keywordsCsv,onChange:s=>l(t=>({...t,keywordsCsv:s.target.value})),className:"cedros-admin__input",placeholder:"returns, refund, policy"}),e.jsx("span",{className:"cedros-admin__hint",children:"Comma-separated keywords to help AI find this FAQ."})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsxs("label",{className:"cedros-admin__checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:n.active,onChange:s=>l(t=>({...t,active:s.target.checked}))}),e.jsx("span",{children:"Active"})]}),e.jsx("span",{className:"cedros-admin__hint",children:"Inactive FAQs won't appear anywhere."})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsx("label",{className:"cedros-admin__label",children:"Visibility"}),e.jsxs("div",{className:"cedros-admin__checkbox-group",children:[e.jsxs("label",{className:"cedros-admin__checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:n.useInChat,onChange:s=>l(t=>({...t,useInChat:s.target.checked}))}),e.jsx("span",{children:"Use in AI Chat"})]}),e.jsxs("label",{className:"cedros-admin__checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:n.displayOnPage,onChange:s=>l(t=>({...t,displayOnPage:s.target.checked}))}),e.jsx("span",{children:"Display on FAQ Page"})]})]}),e.jsx("span",{className:"cedros-admin__hint",children:"Choose where this FAQ should appear."})]}),e.jsxs("div",{className:"cedros-admin__form-actions",children:[e.jsx("button",{type:"button",className:"cedros-admin__button",onClick:y,children:"Cancel"}),e.jsx("button",{type:"submit",className:"cedros-admin__button cedros-admin__button--primary",disabled:F||!n.question.trim()||!n.answer.trim(),children:F?d.Icons.loading:p?"Update FAQ":"Create FAQ"})]})]})}),Q?e.jsxs("div",{className:"cedros-admin__loading",children:[d.Icons.loading,e.jsx("span",{children:"Loading FAQs..."})]}):k.length===0?e.jsx("div",{className:"cedros-admin__empty",children:e.jsx("p",{children:x||v!=="all"?"No FAQs match your filters.":"No FAQs yet. Add one to get started."})}):e.jsx("div",{className:"cedros-admin__faq-list",children:k.map(s=>e.jsxs("div",{className:`cedros-admin__faq-item ${s.active?"":"cedros-admin__faq-item--inactive"}`,children:[e.jsxs("div",{className:"cedros-admin__faq-content",children:[e.jsxs("div",{className:"cedros-admin__faq-question",children:[e.jsx("span",{className:`cedros-admin__status-dot ${s.active?"cedros-admin__status-dot--active":"cedros-admin__status-dot--inactive"}`}),s.question]}),e.jsx("div",{className:"cedros-admin__faq-answer",children:s.answer}),e.jsxs("div",{className:"cedros-admin__faq-meta",children:[s.keywords.length>0&&e.jsx("div",{className:"cedros-admin__faq-keywords",children:s.keywords.map(t=>e.jsx("span",{className:"cedros-admin__tag",children:t},t))}),e.jsxs("div",{className:"cedros-admin__faq-visibility",children:[s.useInChat&&e.jsxs("span",{className:"cedros-admin__badge cedros-admin__badge--chat",title:"Used in AI Chat",children:[d.Icons.chat," Chat"]}),s.displayOnPage&&e.jsxs("span",{className:"cedros-admin__badge cedros-admin__badge--page",title:"Displayed on FAQ Page",children:[d.Icons.globe," Page"]})]})]})]}),e.jsxs("div",{className:"cedros-admin__faq-actions",children:[e.jsx("button",{className:"cedros-admin__button--icon",onClick:()=>D(s),title:s.active?"Deactivate":"Activate",children:s.active?d.Icons.eyeOff:d.Icons.eye}),e.jsx("button",{className:"cedros-admin__button--icon",onClick:()=>L(s),title:"Edit",children:d.Icons.edit}),e.jsx("button",{className:"cedros-admin__button--icon cedros-admin__btn--danger",onClick:()=>b(s.id),title:"Delete",children:d.Icons.trash})]}),q===s.id&&e.jsx("div",{className:"cedros-admin__confirm-overlay",children:e.jsxs("div",{className:"cedros-admin__confirm-dialog",children:[e.jsx("p",{children:"Delete this FAQ?"}),e.jsxs("div",{className:"cedros-admin__confirm-actions",children:[e.jsx("button",{className:"cedros-admin__button",onClick:()=>b(null),children:"Cancel"}),e.jsx("button",{className:"cedros-admin__button cedros-admin__button--danger",onClick:()=>T(s.id),children:"Delete"})]})]})})]},s.id))})]})]})}exports.FAQSection=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),d=require("./index-IZ4WcMd7.js");function R({serverUrl:h,apiKey:o,pageSize:g=20,authManager:r}){const[u,N]=c.useState([]),[Q,w]=c.useState(!0),[S,f]=c.useState(!1),[p,A]=c.useState(null),[F,C]=c.useState(!1),[x,P]=c.useState(""),[v,O]=c.useState("all"),[q,b]=c.useState(null),[$,j]=c.useState(null),[n,l]=c.useState({question:"",answer:"",keywordsCsv:"",active:!0,useInChat:!0,displayOnPage:!0}),_=c.useCallback(async()=>{w(!0);try{j(null);let s;const t=`/admin/faqs?limit=${g}`;if(r?.isAuthenticated())s=await r.fetchWithAuth(t);else{const i={"Content-Type":"application/json"};o&&(i["X-API-Key"]=o);const a=await fetch(`${h}${t}`,{headers:i});if(!a.ok)throw new Error(`Failed to fetch FAQs: ${a.status}`);s=await a.json()}N(s.faqs||[])}catch{N([]),j("Failed to load FAQs")}finally{w(!1)}},[h,o,g,r]);c.useEffect(()=>{_()},[_]);const E=async s=>{if(s.preventDefault(),!(!n.question.trim()||!n.answer.trim())){C(!0);try{const t=n.keywordsCsv.split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),i={question:n.question.trim(),answer:n.answer.trim(),keywords:t,active:n.active,useInChat:n.useInChat,displayOnPage:n.displayOnPage};if(p){const a=`/admin/faqs/${p.id}`;if(r?.isAuthenticated())await r.fetchWithAuth(a,{method:"PUT",body:JSON.stringify(i)});else{const m={"Content-Type":"application/json"};o&&(m["X-API-Key"]=o);const I=await fetch(`${h}${a}`,{method:"PUT",headers:m,body:JSON.stringify(i)});if(!I.ok)throw new Error(`Failed to update FAQ: ${I.status}`)}}else if(r?.isAuthenticated())await r.fetchWithAuth("/admin/faqs",{method:"POST",body:JSON.stringify(i)});else{const a={"Content-Type":"application/json"};o&&(a["X-API-Key"]=o);const m=await fetch(`${h}/admin/faqs`,{method:"POST",headers:a,body:JSON.stringify(i)});if(!m.ok)throw new Error(`Failed to create FAQ: ${m.status}`)}y(),_()}catch{j(p?"Failed to update FAQ":"Failed to create FAQ")}finally{C(!1)}}},T=async s=>{try{const t=`/admin/faqs/${s}`;if(r?.isAuthenticated())await r.fetchWithAuth(t,{method:"DELETE"});else{const i={"Content-Type":"application/json"};o&&(i["X-API-Key"]=o);const a=await fetch(`${h}${t}`,{method:"DELETE",headers:i});if(!a.ok)throw new Error(`Failed to delete FAQ: ${a.status}`)}_()}catch{j("Failed to delete FAQ")}b(null)},D=async s=>{try{const t=`/admin/faqs/${s.id}`,i={...s,active:!s.active};if(r?.isAuthenticated())await r.fetchWithAuth(t,{method:"PUT",body:JSON.stringify(i)});else{const a={"Content-Type":"application/json"};o&&(a["X-API-Key"]=o);const m=await fetch(`${h}${t}`,{method:"PUT",headers:a,body:JSON.stringify(i)});if(!m.ok)throw new Error(`Failed to update FAQ: ${m.status}`)}_()}catch{j("Failed to update FAQ status")}},y=()=>{l({question:"",answer:"",keywordsCsv:"",active:!0,useInChat:!0,displayOnPage:!0}),A(null),f(!1)},L=s=>{l({question:s.question,answer:s.answer,keywordsCsv:s.keywords.join(", "),active:s.active,useInChat:s.useInChat??!0,displayOnPage:s.displayOnPage??!0}),A(s),f(!0)},W=u.length,B=u.filter(s=>s.active).length,J=u.filter(s=>s.active&&s.useInChat).length,X=u.filter(s=>s.active&&s.displayOnPage).length,k=c.useMemo(()=>u.filter(s=>{if(v==="active"&&!s.active||v==="inactive"&&s.active)return!1;if(x){const t=x.toLowerCase();return s.question.toLowerCase().includes(t)||s.answer.toLowerCase().includes(t)||s.keywords.some(i=>i.includes(t))}return!0}),[u,v,x]);return e.jsxs("div",{className:"cedros-admin__faqs",children:[e.jsx(d.ErrorBanner,{message:$,onRetry:_}),e.jsx(d.StatsBar,{stats:[{label:"Total FAQs",value:W},{label:"Active",value:B,variant:"success"},{label:"In Chat",value:J},{label:"On Page",value:X}]}),e.jsxs("div",{className:"cedros-admin__section",children:[e.jsxs("div",{className:"cedros-admin__section-header",children:[e.jsxs("div",{className:"cedros-admin__section-header-left",children:[e.jsx("h3",{className:"cedros-admin__section-title",children:"Knowledge Base"}),e.jsx("p",{className:"cedros-admin__section-subtitle",children:"Manage FAQs for the AI chat assistant and public FAQ page."})]}),e.jsx("div",{className:"cedros-admin__section-header-right",children:e.jsxs("button",{className:"cedros-admin__button cedros-admin__button--primary",onClick:()=>{y(),f(!0)},children:[d.Icons.plus," Add FAQ"]})})]}),e.jsxs("div",{className:"cedros-admin__filters",style:{display:"flex",gap:"1rem",marginBottom:"1rem"},children:[e.jsx("input",{type:"text",placeholder:"Search FAQs...",value:x,onChange:s=>P(s.target.value),className:"cedros-admin__input",style:{flex:1,maxWidth:300}}),e.jsxs("select",{value:v,onChange:s=>O(s.target.value),className:"cedros-admin__select",children:[e.jsx("option",{value:"all",children:"All Status"}),e.jsx("option",{value:"active",children:"Active Only"}),e.jsx("option",{value:"inactive",children:"Inactive Only"})]})]}),S&&e.jsx("div",{className:"cedros-admin__form-container",style:{marginBottom:"1.5rem"},children:e.jsxs("form",{onSubmit:E,className:"cedros-admin__form",children:[e.jsxs("div",{className:"cedros-admin__form-header",children:[e.jsx("h4",{children:p?"Edit FAQ":"Add New FAQ"}),e.jsx("button",{type:"button",className:"cedros-admin__button--icon",onClick:y,children:d.Icons.close})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsx("label",{className:"cedros-admin__label",children:"Question *"}),e.jsx("input",{type:"text",value:n.question,onChange:s=>l(t=>({...t,question:s.target.value})),className:"cedros-admin__input",placeholder:"What is your return policy?",required:!0})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsx("label",{className:"cedros-admin__label",children:"Answer *"}),e.jsx("textarea",{value:n.answer,onChange:s=>l(t=>({...t,answer:s.target.value})),className:"cedros-admin__textarea",placeholder:"We accept returns within 30 days...",rows:4,required:!0}),e.jsx("span",{className:"cedros-admin__hint",children:"Supports markdown formatting."})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsx("label",{className:"cedros-admin__label",children:"Keywords"}),e.jsx("input",{type:"text",value:n.keywordsCsv,onChange:s=>l(t=>({...t,keywordsCsv:s.target.value})),className:"cedros-admin__input",placeholder:"returns, refund, policy"}),e.jsx("span",{className:"cedros-admin__hint",children:"Comma-separated keywords to help AI find this FAQ."})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsxs("label",{className:"cedros-admin__checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:n.active,onChange:s=>l(t=>({...t,active:s.target.checked}))}),e.jsx("span",{children:"Active"})]}),e.jsx("span",{className:"cedros-admin__hint",children:"Inactive FAQs won't appear anywhere."})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsx("label",{className:"cedros-admin__label",children:"Visibility"}),e.jsxs("div",{className:"cedros-admin__checkbox-group",children:[e.jsxs("label",{className:"cedros-admin__checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:n.useInChat,onChange:s=>l(t=>({...t,useInChat:s.target.checked}))}),e.jsx("span",{children:"Use in AI Chat"})]}),e.jsxs("label",{className:"cedros-admin__checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:n.displayOnPage,onChange:s=>l(t=>({...t,displayOnPage:s.target.checked}))}),e.jsx("span",{children:"Display on FAQ Page"})]})]}),e.jsx("span",{className:"cedros-admin__hint",children:"Choose where this FAQ should appear."})]}),e.jsxs("div",{className:"cedros-admin__form-actions",children:[e.jsx("button",{type:"button",className:"cedros-admin__button",onClick:y,children:"Cancel"}),e.jsx("button",{type:"submit",className:"cedros-admin__button cedros-admin__button--primary",disabled:F||!n.question.trim()||!n.answer.trim(),children:F?d.Icons.loading:p?"Update FAQ":"Create FAQ"})]})]})}),Q?e.jsxs("div",{className:"cedros-admin__loading",children:[d.Icons.loading,e.jsx("span",{children:"Loading FAQs..."})]}):k.length===0?e.jsx("div",{className:"cedros-admin__empty",children:e.jsx("p",{children:x||v!=="all"?"No FAQs match your filters.":"No FAQs yet. Add one to get started."})}):e.jsx("div",{className:"cedros-admin__faq-list",children:k.map(s=>e.jsxs("div",{className:`cedros-admin__faq-item ${s.active?"":"cedros-admin__faq-item--inactive"}`,children:[e.jsxs("div",{className:"cedros-admin__faq-content",children:[e.jsxs("div",{className:"cedros-admin__faq-question",children:[e.jsx("span",{className:`cedros-admin__status-dot ${s.active?"cedros-admin__status-dot--active":"cedros-admin__status-dot--inactive"}`}),s.question]}),e.jsx("div",{className:"cedros-admin__faq-answer",children:s.answer}),e.jsxs("div",{className:"cedros-admin__faq-meta",children:[s.keywords.length>0&&e.jsx("div",{className:"cedros-admin__faq-keywords",children:s.keywords.map(t=>e.jsx("span",{className:"cedros-admin__tag",children:t},t))}),e.jsxs("div",{className:"cedros-admin__faq-visibility",children:[s.useInChat&&e.jsxs("span",{className:"cedros-admin__badge cedros-admin__badge--chat",title:"Used in AI Chat",children:[d.Icons.chat," Chat"]}),s.displayOnPage&&e.jsxs("span",{className:"cedros-admin__badge cedros-admin__badge--page",title:"Displayed on FAQ Page",children:[d.Icons.globe," Page"]})]})]})]}),e.jsxs("div",{className:"cedros-admin__faq-actions",children:[e.jsx("button",{className:"cedros-admin__button--icon",onClick:()=>D(s),title:s.active?"Deactivate":"Activate",children:s.active?d.Icons.eyeOff:d.Icons.eye}),e.jsx("button",{className:"cedros-admin__button--icon",onClick:()=>L(s),title:"Edit",children:d.Icons.edit}),e.jsx("button",{className:"cedros-admin__button--icon cedros-admin__btn--danger",onClick:()=>b(s.id),title:"Delete",children:d.Icons.trash})]}),q===s.id&&e.jsx("div",{className:"cedros-admin__confirm-overlay",children:e.jsxs("div",{className:"cedros-admin__confirm-dialog",children:[e.jsx("p",{children:"Delete this FAQ?"}),e.jsxs("div",{className:"cedros-admin__confirm-actions",children:[e.jsx("button",{className:"cedros-admin__button",onClick:()=>b(null),children:"Cancel"}),e.jsx("button",{className:"cedros-admin__button cedros-admin__button--danger",onClick:()=>T(s.id),children:"Delete"})]})]})})]},s.id))})]})]})}exports.FAQSection=R;
@@ -1,6 +1,6 @@
1
1
  import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
2
  import { useState as r, useCallback as R, useEffect as V, useMemo as G } from "react";
3
- import { E as H, b as Y, I as l } from "./index-75RhiLDq.mjs";
3
+ import { E as H, f as Y, I as l } from "./index-CufXF9Yd.mjs";
4
4
  function M({ serverUrl: u, apiKey: d, pageSize: A = 20, authManager: o }) {
5
5
  const [_, F] = r([]), [E, C] = r(!0), [S, N] = r(!1), [v, k] = r(null), [Q, I] = r(!1), [y, $] = r(""), [f, x] = r("all"), [q, w] = r(null), [T, b] = r(null), [n, m] = r({
6
6
  question: "",
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),y=require("./index-IZ4WcMd7.js"),S=require("./Toggle-CsPSF8Dr.js"),q=require("./useAutosave-B2p6iwh8.js"),z=require("./AutosaveIndicator-C-CH-obR.js"),p={mailgun:{label:"Mailgun",host:"smtp.mailgun.org",username:"",credentialLabel:"SMTP Password",showUsername:!0,usernameEqualsPassword:!1},sendgrid:{label:"SendGrid",host:"smtp.sendgrid.net",username:"apikey",credentialLabel:"API Key",showUsername:!1,usernameEqualsPassword:!1},postmark:{label:"Postmark",host:"smtp.postmarkapp.com",username:"",credentialLabel:"Server API Token",showUsername:!1,usernameEqualsPassword:!0},ses:{label:"AWS SES",host:"email-smtp.us-east-1.amazonaws.com",username:"",credentialLabel:"SMTP Password",showUsername:!0,usernameEqualsPassword:!1},resend:{label:"Resend",host:"smtp.resend.com",username:"resend",credentialLabel:"API Key",showUsername:!1,usernameEqualsPassword:!1},custom:{label:"Custom SMTP",host:"",username:"",credentialLabel:"SMTP Password",showUsername:!0,usernameEqualsPassword:!1}};function R(c){if(!c)return"custom";for(const[d,n]of Object.entries(p))if(n.host&&c===n.host)return d;return"custom"}const v={email_enabled:!1,email_provider:"custom",smtp_host:"",smtp_port:587,smtp_username:"",smtp_password:"",from_email:"",from_name:"",webhook_enabled:!1,webhook_url:"",webhook_secret:"",webhook_timeout:30};function W({serverUrl:c,apiKey:d,authManager:n}){const[m,b]=l.useState("messages"),[a,h]=l.useState(v),[N,k]=l.useState(!0),[C,E]=l.useState(!0),[P,f]=l.useState(null),[_,j]=l.useState(new Set),g=l.useCallback(async()=>{try{f(null);let s;const t="/admin/config/messaging";if(n?.isAuthenticated())s=await n.fetchWithAuth(t);else{const o={"Content-Type":"application/json"};d&&(o["X-API-Key"]=d);const u=await fetch(`${c}${t}`,{headers:o});if(!u.ok)throw new Error(`Failed to fetch: ${u.status}`);s=await u.json()}const i={...v,...s.config};i.email_provider||(i.email_provider=R(i.smtp_host)),h(i)}catch{h(v),f("Could not load saved settings. Showing defaults.")}finally{k(!1),setTimeout(()=>E(!1),100)}},[c,d,n]);l.useEffect(()=>{g()},[g]);const T=l.useCallback(async s=>{const t="/admin/config/messaging",i={...s};_.has("smtp_password")||delete i.smtp_password,_.has("webhook_secret")||delete i.webhook_secret;const o=JSON.stringify({config:i});try{if(n?.isAuthenticated())await n.fetchWithAuth(t,{method:"PUT",body:o});else{const u={"Content-Type":"application/json"};d&&(u["X-API-Key"]=d);const w=await fetch(`${c}${t}`,{method:"PUT",headers:u,body:o});if(!w.ok)throw new Error(`Failed to save: ${w.status}`)}}catch{throw f("Failed to save messaging settings"),new Error("Save failed")}},[c,d,n,_]),{status:A,error:I}=q.useAutosave({data:a,onSave:T,debounceMs:1500,enabled:!C}),r=(s,t)=>{(s==="smtp_password"||s==="webhook_secret")&&j(i=>new Set(i).add(s)),h(i=>({...i,[s]:t}))},L=s=>{const t=p[s];h(i=>({...i,email_provider:s,smtp_host:t.host||i.smtp_host,smtp_port:587,smtp_username:t.username||(t.showUsername?i.smtp_username:"")}))},M=s=>{const t=a.email_provider||"custom",i=p[t];j(o=>new Set(o).add("smtp_password")),i.usernameEqualsPassword?h(o=>({...o,smtp_password:s,smtp_username:s})):h(o=>({...o,smtp_password:s}))},x=p[a.email_provider||"custom"]??p.custom;return N?e.jsxs("div",{className:"cedros-admin__messaging-settings",children:[e.jsxs("div",{className:"cedros-admin__page-header",children:[e.jsx("h2",{className:"cedros-admin__page-title",children:"Store Messages"}),e.jsx("p",{className:"cedros-admin__page-description",children:"Configure email delivery and webhook notifications."})]}),e.jsxs("div",{className:"cedros-admin__loading",style:{marginTop:"1rem"},children:[y.Icons.loading," Loading message settings..."]})]}):e.jsxs("div",{className:"cedros-admin__messaging-settings",children:[e.jsxs("div",{className:"cedros-admin__page-header",children:[e.jsx("h2",{className:"cedros-admin__page-title",children:"Store Messages"}),e.jsx("p",{className:"cedros-admin__page-description",children:"Configure email delivery and webhook notifications."})]}),e.jsxs("div",{className:"cedros-admin__tabs cedros-admin__tabs--line",children:[e.jsx("button",{type:"button",className:`cedros-admin__tab ${m==="messages"?"cedros-admin__tab--active":""}`,onClick:()=>b("messages"),children:"Messages"}),e.jsx("button",{type:"button",className:`cedros-admin__tab ${m==="email"?"cedros-admin__tab--active":""}`,onClick:()=>b("email"),children:"Email"}),e.jsx("button",{type:"button",className:`cedros-admin__tab ${m==="webhooks"?"cedros-admin__tab--active":""}`,onClick:()=>b("webhooks"),children:"Webhooks"}),e.jsx("div",{style:{flex:1}}),e.jsx(z.AutosaveIndicator,{status:A,error:I})]}),e.jsx(y.ErrorBanner,{message:P,onRetry:g}),e.jsxs("div",{className:"cedros-admin__tab-content",style:{marginTop:"1rem"},children:[m==="messages"&&e.jsxs("div",{className:"cedros-admin__section",children:[e.jsx("p",{style:{marginBottom:"1.5rem",fontSize:"0.875rem",opacity:.7},children:"Enable or disable notification types. Configure the delivery settings in the Email or Webhooks tab."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"1rem",padding:"1rem",border:"1px solid var(--cedros-admin-border, #e5e5e5)",borderRadius:"0.5rem"},children:[e.jsx(S.Toggle,{checked:a.email_enabled,onChange:s=>r("email_enabled",s)}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:"Email Confirmation"}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:"0.8125rem",opacity:.6},children:"Send order confirmation emails to customers after successful purchase."}),e.jsx("p",{style:{margin:"0.5rem 0 0",fontSize:"0.75rem",opacity:.5},children:"Requires Email configuration"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"1rem",padding:"1rem",border:"1px solid var(--cedros-admin-border, #e5e5e5)",borderRadius:"0.5rem"},children:[e.jsx(S.Toggle,{checked:a.webhook_enabled,onChange:s=>r("webhook_enabled",s)}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:"Admin Purchase Notification"}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:"0.8125rem",opacity:.6},children:"Send webhook notifications to your server when a purchase is completed."}),e.jsx("p",{style:{margin:"0.5rem 0 0",fontSize:"0.75rem",opacity:.5},children:"Requires Webhook configuration"})]})]})]})]}),m==="email"&&e.jsxs("div",{className:"cedros-admin__section",children:[e.jsx("p",{style:{marginBottom:"1.5rem",fontSize:"0.875rem",opacity:.7},children:"Select your email service provider for automatic configuration."}),!a.email_enabled&&e.jsx("div",{style:{padding:"1rem",marginBottom:"1.5rem",background:"var(--cedros-admin-bg-accent, #fef3c7)",borderRadius:"0.5rem",border:"1px solid var(--cedros-admin-warning, #f59e0b)",fontSize:"0.875rem"},children:"Email notifications are disabled. Enable them in the Messages tab."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",opacity:a.email_enabled?1:.5},children:[e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Email Provider"}),e.jsx("select",{className:"cedros-admin__input",value:a.email_provider||"custom",onChange:s=>L(s.target.value),disabled:!a.email_enabled,children:Object.entries(p).map(([s,{label:t}])=>e.jsx("option",{value:s,children:t},s))})]}),a.email_provider==="custom"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"SMTP Host"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:a.smtp_host,onChange:s=>r("smtp_host",s.target.value),placeholder:"smtp.example.com",disabled:!a.email_enabled})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"SMTP Port"}),e.jsx("input",{type:"number",className:"cedros-admin__input",value:a.smtp_port,onChange:s=>r("smtp_port",parseInt(s.target.value)||587),placeholder:"587",disabled:!a.email_enabled,style:{maxWidth:120}}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:"0.75rem",opacity:.6},children:"Common: 587 (TLS), 465 (SSL), 25 (unencrypted)."})]})]}),x.showUsername&&e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"SMTP Username"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:a.smtp_username,onChange:s=>r("smtp_username",s.target.value),placeholder:a.email_provider==="mailgun"?"postmaster@your-domain.com":"username",disabled:!a.email_enabled})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:x.credentialLabel}),e.jsx("input",{type:"password",className:"cedros-admin__input",value:_.has("smtp_password")?a.smtp_password:"",onChange:s=>M(s.target.value),placeholder:a.smtp_password?"••••••••":`Enter ${x.credentialLabel.toLowerCase()}`,disabled:!a.email_enabled})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"From Email"}),e.jsx("input",{type:"email",className:"cedros-admin__input",value:a.from_email,onChange:s=>r("from_email",s.target.value),placeholder:"noreply@example.com",disabled:!a.email_enabled}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:"0.75rem",opacity:.6},children:"Default sender email address."})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"From Name"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:a.from_name,onChange:s=>r("from_name",s.target.value),placeholder:"Your Store",disabled:!a.email_enabled}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:"0.75rem",opacity:.6},children:"Default sender display name."})]})]})]}),m==="webhooks"&&e.jsxs("div",{className:"cedros-admin__section",children:[e.jsx("p",{style:{marginBottom:"1.5rem",fontSize:"0.875rem",opacity:.7},children:"Configure webhook endpoint for receiving purchase notifications."}),!a.webhook_enabled&&e.jsx("div",{style:{padding:"1rem",marginBottom:"1.5rem",background:"var(--cedros-admin-bg-accent, #fef3c7)",borderRadius:"0.5rem",border:"1px solid var(--cedros-admin-warning, #f59e0b)",fontSize:"0.875rem"},children:"Webhook notifications are disabled. Enable them in the Messages tab."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",opacity:a.webhook_enabled?1:.5},children:[e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Webhook URL"}),e.jsx("input",{type:"url",className:"cedros-admin__input",value:a.webhook_url,onChange:s=>r("webhook_url",s.target.value),placeholder:"https://api.yoursite.com/webhooks/orders",disabled:!a.webhook_enabled})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Webhook Secret"}),e.jsx("input",{type:"password",className:"cedros-admin__input",value:_.has("webhook_secret")?a.webhook_secret:"",onChange:s=>r("webhook_secret",s.target.value),placeholder:a.webhook_secret?"••••••••":"Enter secret for HMAC-SHA256",disabled:!a.webhook_enabled}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:"0.75rem",opacity:.6},children:"Used for HMAC-SHA256 signature verification"})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Timeout (seconds)"}),e.jsx("input",{type:"number",className:"cedros-admin__input",value:a.webhook_timeout,onChange:s=>r("webhook_timeout",parseInt(s.target.value)||30),placeholder:"30",disabled:!a.webhook_enabled,style:{maxWidth:120}})]})]})]})]})]})}exports.MessagingSection=W;
@@ -1,11 +1,26 @@
1
- import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
- import { useState as m, useCallback as w, useEffect as W } from "react";
3
- import { I as z, E as M } from "./index-75RhiLDq.mjs";
4
- import { T as N } from "./Toggle-DAxIdpY4.mjs";
5
- import { u as $ } from "./useAutosave-YwMqRzqy.mjs";
6
- import { A as F } from "./AutosaveIndicator-DTOaopUP.mjs";
7
- const g = {
1
+ import { jsxs as i, jsx as e, Fragment as R } from "react/jsx-runtime";
2
+ import { useState as _, useCallback as k, useEffect as U } from "react";
3
+ import { I as $, E as q } from "./index-CufXF9Yd.mjs";
4
+ import { T as C } from "./Toggle-DAxIdpY4.mjs";
5
+ import { u as F } from "./useAutosave-YwMqRzqy.mjs";
6
+ import { A as j } from "./AutosaveIndicator-CWbb-VXf.mjs";
7
+ const u = {
8
+ mailgun: { label: "Mailgun", host: "smtp.mailgun.org", username: "", credentialLabel: "SMTP Password", showUsername: !0, usernameEqualsPassword: !1 },
9
+ sendgrid: { label: "SendGrid", host: "smtp.sendgrid.net", username: "apikey", credentialLabel: "API Key", showUsername: !1, usernameEqualsPassword: !1 },
10
+ postmark: { label: "Postmark", host: "smtp.postmarkapp.com", username: "", credentialLabel: "Server API Token", showUsername: !1, usernameEqualsPassword: !0 },
11
+ ses: { label: "AWS SES", host: "email-smtp.us-east-1.amazonaws.com", username: "", credentialLabel: "SMTP Password", showUsername: !0, usernameEqualsPassword: !1 },
12
+ resend: { label: "Resend", host: "smtp.resend.com", username: "resend", credentialLabel: "API Key", showUsername: !1, usernameEqualsPassword: !1 },
13
+ custom: { label: "Custom SMTP", host: "", username: "", credentialLabel: "SMTP Password", showUsername: !0, usernameEqualsPassword: !1 }
14
+ };
15
+ function D(m) {
16
+ if (!m) return "custom";
17
+ for (const [l, d] of Object.entries(u))
18
+ if (d.host && m === d.host) return l;
19
+ return "custom";
20
+ }
21
+ const y = {
8
22
  email_enabled: !1,
23
+ email_provider: "custom",
9
24
  smtp_host: "",
10
25
  smtp_port: 587,
11
26
  smtp_username: "",
@@ -17,62 +32,76 @@ const g = {
17
32
  webhook_secret: "",
18
33
  webhook_timeout: 30
19
34
  };
20
- function U({ serverUrl: _, apiKey: n, authManager: r }) {
21
- const [l, p] = m("messages"), [s, b] = m(g), [k, S] = m(!0), [x, C] = m(!0), [E, f] = m(null), [h, T] = m(/* @__PURE__ */ new Set()), u = w(async () => {
35
+ function V({ serverUrl: m, apiKey: l, authManager: d }) {
36
+ const [c, f] = _("messages"), [s, h] = _(y), [E, P] = _(!0), [x, T] = _(!0), [A, g] = _(null), [b, S] = _(/* @__PURE__ */ new Set()), v = k(async () => {
22
37
  try {
23
- f(null);
38
+ g(null);
24
39
  let a;
25
- const d = "/admin/config/messaging";
26
- if (r?.isAuthenticated())
27
- a = await r.fetchWithAuth(d);
40
+ const r = "/admin/config/messaging";
41
+ if (d?.isAuthenticated())
42
+ a = await d.fetchWithAuth(r);
28
43
  else {
29
44
  const t = { "Content-Type": "application/json" };
30
- n && (t["X-API-Key"] = n);
31
- const c = await fetch(`${_}${d}`, { headers: t });
32
- if (!c.ok) throw new Error(`Failed to fetch: ${c.status}`);
33
- a = await c.json();
45
+ l && (t["X-API-Key"] = l);
46
+ const p = await fetch(`${m}${r}`, { headers: t });
47
+ if (!p.ok) throw new Error(`Failed to fetch: ${p.status}`);
48
+ a = await p.json();
34
49
  }
35
- b({ ...g, ...a.config });
50
+ const o = { ...y, ...a.config };
51
+ o.email_provider || (o.email_provider = D(o.smtp_host)), h(o);
36
52
  } catch {
37
- b(g), f("Could not load saved settings. Showing defaults.");
53
+ h(y), g("Could not load saved settings. Showing defaults.");
38
54
  } finally {
39
- S(!1), setTimeout(() => C(!1), 100);
55
+ P(!1), setTimeout(() => T(!1), 100);
40
56
  }
41
- }, [_, n, r]);
42
- W(() => {
43
- u();
44
- }, [u]);
45
- const A = w(async (a) => {
46
- const d = "/admin/config/messaging", t = { ...a };
47
- h.has("smtp_password") || delete t.smtp_password, h.has("webhook_secret") || delete t.webhook_secret;
48
- const c = JSON.stringify({ config: t });
57
+ }, [m, l, d]);
58
+ U(() => {
59
+ v();
60
+ }, [v]);
61
+ const I = k(async (a) => {
62
+ const r = "/admin/config/messaging", o = { ...a };
63
+ b.has("smtp_password") || delete o.smtp_password, b.has("webhook_secret") || delete o.webhook_secret;
64
+ const t = JSON.stringify({ config: o });
49
65
  try {
50
- if (r?.isAuthenticated())
51
- await r.fetchWithAuth(d, { method: "PUT", body: c });
66
+ if (d?.isAuthenticated())
67
+ await d.fetchWithAuth(r, { method: "PUT", body: t });
52
68
  else {
53
- const v = { "Content-Type": "application/json" };
54
- n && (v["X-API-Key"] = n);
55
- const y = await fetch(`${_}${d}`, { method: "PUT", headers: v, body: c });
56
- if (!y.ok) throw new Error(`Failed to save: ${y.status}`);
69
+ const p = { "Content-Type": "application/json" };
70
+ l && (p["X-API-Key"] = l);
71
+ const N = await fetch(`${m}${r}`, { method: "PUT", headers: p, body: t });
72
+ if (!N.ok) throw new Error(`Failed to save: ${N.status}`);
57
73
  }
58
74
  } catch {
59
- throw f("Failed to save messaging settings"), new Error("Save failed");
75
+ throw g("Failed to save messaging settings"), new Error("Save failed");
60
76
  }
61
- }, [_, n, r, h]), { status: I, error: P } = $({
77
+ }, [m, l, d, b]), { status: L, error: z } = F({
62
78
  data: s,
63
- onSave: A,
79
+ onSave: I,
64
80
  debounceMs: 1500,
65
81
  enabled: !x
66
- }), o = (a, d) => {
67
- (a === "smtp_password" || a === "webhook_secret") && T((t) => new Set(t).add(a)), b((t) => ({ ...t, [a]: d }));
68
- };
69
- return k ? /* @__PURE__ */ i("div", { className: "cedros-admin__messaging-settings", children: [
82
+ }), n = (a, r) => {
83
+ (a === "smtp_password" || a === "webhook_secret") && S((o) => new Set(o).add(a)), h((o) => ({ ...o, [a]: r }));
84
+ }, M = (a) => {
85
+ const r = u[a];
86
+ h((o) => ({
87
+ ...o,
88
+ email_provider: a,
89
+ smtp_host: r.host || o.smtp_host,
90
+ smtp_port: 587,
91
+ // Fixed username providers get it auto-set; others keep existing value
92
+ smtp_username: r.username || (r.showUsername ? o.smtp_username : "")
93
+ }));
94
+ }, W = (a) => {
95
+ const r = s.email_provider || "custom", o = u[r];
96
+ S((t) => new Set(t).add("smtp_password")), o.usernameEqualsPassword ? h((t) => ({ ...t, smtp_password: a, smtp_username: a })) : h((t) => ({ ...t, smtp_password: a }));
97
+ }, w = u[s.email_provider || "custom"] ?? u.custom;
98
+ return E ? /* @__PURE__ */ i("div", { className: "cedros-admin__messaging-settings", children: [
70
99
  /* @__PURE__ */ i("div", { className: "cedros-admin__page-header", children: [
71
100
  /* @__PURE__ */ e("h2", { className: "cedros-admin__page-title", children: "Store Messages" }),
72
101
  /* @__PURE__ */ e("p", { className: "cedros-admin__page-description", children: "Configure email delivery and webhook notifications." })
73
102
  ] }),
74
103
  /* @__PURE__ */ i("div", { className: "cedros-admin__loading", style: { marginTop: "1rem" }, children: [
75
- z.loading,
104
+ $.loading,
76
105
  " Loading message settings..."
77
106
  ] })
78
107
  ] }) : /* @__PURE__ */ i("div", { className: "cedros-admin__messaging-settings", children: [
@@ -85,8 +114,8 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
85
114
  "button",
86
115
  {
87
116
  type: "button",
88
- className: `cedros-admin__tab ${l === "messages" ? "cedros-admin__tab--active" : ""}`,
89
- onClick: () => p("messages"),
117
+ className: `cedros-admin__tab ${c === "messages" ? "cedros-admin__tab--active" : ""}`,
118
+ onClick: () => f("messages"),
90
119
  children: "Messages"
91
120
  }
92
121
  ),
@@ -94,8 +123,8 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
94
123
  "button",
95
124
  {
96
125
  type: "button",
97
- className: `cedros-admin__tab ${l === "email" ? "cedros-admin__tab--active" : ""}`,
98
- onClick: () => p("email"),
126
+ className: `cedros-admin__tab ${c === "email" ? "cedros-admin__tab--active" : ""}`,
127
+ onClick: () => f("email"),
99
128
  children: "Email"
100
129
  }
101
130
  ),
@@ -103,17 +132,17 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
103
132
  "button",
104
133
  {
105
134
  type: "button",
106
- className: `cedros-admin__tab ${l === "webhooks" ? "cedros-admin__tab--active" : ""}`,
107
- onClick: () => p("webhooks"),
135
+ className: `cedros-admin__tab ${c === "webhooks" ? "cedros-admin__tab--active" : ""}`,
136
+ onClick: () => f("webhooks"),
108
137
  children: "Webhooks"
109
138
  }
110
139
  ),
111
140
  /* @__PURE__ */ e("div", { style: { flex: 1 } }),
112
- /* @__PURE__ */ e(F, { status: I, error: P })
141
+ /* @__PURE__ */ e(j, { status: L, error: z })
113
142
  ] }),
114
- /* @__PURE__ */ e(M, { message: E, onRetry: u }),
143
+ /* @__PURE__ */ e(q, { message: A, onRetry: v }),
115
144
  /* @__PURE__ */ i("div", { className: "cedros-admin__tab-content", style: { marginTop: "1rem" }, children: [
116
- l === "messages" && /* @__PURE__ */ i("div", { className: "cedros-admin__section", children: [
145
+ c === "messages" && /* @__PURE__ */ i("div", { className: "cedros-admin__section", children: [
117
146
  /* @__PURE__ */ e("p", { style: { marginBottom: "1.5rem", fontSize: "0.875rem", opacity: 0.7 }, children: "Enable or disable notification types. Configure the delivery settings in the Email or Webhooks tab." }),
118
147
  /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
119
148
  /* @__PURE__ */ i(
@@ -129,10 +158,10 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
129
158
  },
130
159
  children: [
131
160
  /* @__PURE__ */ e(
132
- N,
161
+ C,
133
162
  {
134
163
  checked: s.email_enabled,
135
- onChange: (a) => o("email_enabled", a)
164
+ onChange: (a) => n("email_enabled", a)
136
165
  }
137
166
  ),
138
167
  /* @__PURE__ */ i("div", { style: { flex: 1 }, children: [
@@ -156,10 +185,10 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
156
185
  },
157
186
  children: [
158
187
  /* @__PURE__ */ e(
159
- N,
188
+ C,
160
189
  {
161
190
  checked: s.webhook_enabled,
162
- onChange: (a) => o("webhook_enabled", a)
191
+ onChange: (a) => n("webhook_enabled", a)
163
192
  }
164
193
  ),
165
194
  /* @__PURE__ */ i("div", { style: { flex: 1 }, children: [
@@ -172,8 +201,8 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
172
201
  )
173
202
  ] })
174
203
  ] }),
175
- l === "email" && /* @__PURE__ */ i("div", { className: "cedros-admin__section", children: [
176
- /* @__PURE__ */ e("p", { style: { marginBottom: "1.5rem", fontSize: "0.875rem", opacity: 0.7 }, children: "Configure your email provider for sending customer notifications." }),
204
+ c === "email" && /* @__PURE__ */ i("div", { className: "cedros-admin__section", children: [
205
+ /* @__PURE__ */ e("p", { style: { marginBottom: "1.5rem", fontSize: "0.875rem", opacity: 0.7 }, children: "Select your email service provider for automatic configuration." }),
177
206
  !s.email_enabled && /* @__PURE__ */ e(
178
207
  "div",
179
208
  {
@@ -190,35 +219,51 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
190
219
  ),
191
220
  /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: "1rem", opacity: s.email_enabled ? 1 : 0.5 }, children: [
192
221
  /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
193
- /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "SMTP Host" }),
222
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Email Provider" }),
194
223
  /* @__PURE__ */ e(
195
- "input",
224
+ "select",
196
225
  {
197
- type: "text",
198
226
  className: "cedros-admin__input",
199
- value: s.smtp_host,
200
- onChange: (a) => o("smtp_host", a.target.value),
201
- placeholder: "smtp.example.com",
202
- disabled: !s.email_enabled
203
- }
204
- )
205
- ] }),
206
- /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
207
- /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "SMTP Port" }),
208
- /* @__PURE__ */ e(
209
- "input",
210
- {
211
- type: "number",
212
- className: "cedros-admin__input",
213
- value: s.smtp_port,
214
- onChange: (a) => o("smtp_port", parseInt(a.target.value) || 587),
215
- placeholder: "587",
227
+ value: s.email_provider || "custom",
228
+ onChange: (a) => M(a.target.value),
216
229
  disabled: !s.email_enabled,
217
- style: { maxWidth: 120 }
230
+ children: Object.entries(u).map(([a, { label: r }]) => /* @__PURE__ */ e("option", { value: a, children: r }, a))
218
231
  }
219
232
  )
220
233
  ] }),
221
- /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
234
+ s.email_provider === "custom" && /* @__PURE__ */ i(R, { children: [
235
+ /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
236
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "SMTP Host" }),
237
+ /* @__PURE__ */ e(
238
+ "input",
239
+ {
240
+ type: "text",
241
+ className: "cedros-admin__input",
242
+ value: s.smtp_host,
243
+ onChange: (a) => n("smtp_host", a.target.value),
244
+ placeholder: "smtp.example.com",
245
+ disabled: !s.email_enabled
246
+ }
247
+ )
248
+ ] }),
249
+ /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
250
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "SMTP Port" }),
251
+ /* @__PURE__ */ e(
252
+ "input",
253
+ {
254
+ type: "number",
255
+ className: "cedros-admin__input",
256
+ value: s.smtp_port,
257
+ onChange: (a) => n("smtp_port", parseInt(a.target.value) || 587),
258
+ placeholder: "587",
259
+ disabled: !s.email_enabled,
260
+ style: { maxWidth: 120 }
261
+ }
262
+ ),
263
+ /* @__PURE__ */ e("p", { style: { margin: "0.25rem 0 0", fontSize: "0.75rem", opacity: 0.6 }, children: "Common: 587 (TLS), 465 (SSL), 25 (unencrypted)." })
264
+ ] })
265
+ ] }),
266
+ w.showUsername && /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
222
267
  /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "SMTP Username" }),
223
268
  /* @__PURE__ */ e(
224
269
  "input",
@@ -226,22 +271,22 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
226
271
  type: "text",
227
272
  className: "cedros-admin__input",
228
273
  value: s.smtp_username,
229
- onChange: (a) => o("smtp_username", a.target.value),
230
- placeholder: "username or API key",
274
+ onChange: (a) => n("smtp_username", a.target.value),
275
+ placeholder: s.email_provider === "mailgun" ? "postmaster@your-domain.com" : "username",
231
276
  disabled: !s.email_enabled
232
277
  }
233
278
  )
234
279
  ] }),
235
280
  /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
236
- /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "SMTP Password" }),
281
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: w.credentialLabel }),
237
282
  /* @__PURE__ */ e(
238
283
  "input",
239
284
  {
240
285
  type: "password",
241
286
  className: "cedros-admin__input",
242
- value: h.has("smtp_password") ? s.smtp_password : "",
243
- onChange: (a) => o("smtp_password", a.target.value),
244
- placeholder: s.smtp_password ? "••••••••" : "Enter password",
287
+ value: b.has("smtp_password") ? s.smtp_password : "",
288
+ onChange: (a) => W(a.target.value),
289
+ placeholder: s.smtp_password ? "••••••••" : `Enter ${w.credentialLabel.toLowerCase()}`,
245
290
  disabled: !s.email_enabled
246
291
  }
247
292
  )
@@ -254,11 +299,12 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
254
299
  type: "email",
255
300
  className: "cedros-admin__input",
256
301
  value: s.from_email,
257
- onChange: (a) => o("from_email", a.target.value),
258
- placeholder: "orders@yourstore.com",
302
+ onChange: (a) => n("from_email", a.target.value),
303
+ placeholder: "noreply@example.com",
259
304
  disabled: !s.email_enabled
260
305
  }
261
- )
306
+ ),
307
+ /* @__PURE__ */ e("p", { style: { margin: "0.25rem 0 0", fontSize: "0.75rem", opacity: 0.6 }, children: "Default sender email address." })
262
308
  ] }),
263
309
  /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
264
310
  /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "From Name" }),
@@ -268,15 +314,16 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
268
314
  type: "text",
269
315
  className: "cedros-admin__input",
270
316
  value: s.from_name,
271
- onChange: (a) => o("from_name", a.target.value),
317
+ onChange: (a) => n("from_name", a.target.value),
272
318
  placeholder: "Your Store",
273
319
  disabled: !s.email_enabled
274
320
  }
275
- )
321
+ ),
322
+ /* @__PURE__ */ e("p", { style: { margin: "0.25rem 0 0", fontSize: "0.75rem", opacity: 0.6 }, children: "Default sender display name." })
276
323
  ] })
277
324
  ] })
278
325
  ] }),
279
- l === "webhooks" && /* @__PURE__ */ i("div", { className: "cedros-admin__section", children: [
326
+ c === "webhooks" && /* @__PURE__ */ i("div", { className: "cedros-admin__section", children: [
280
327
  /* @__PURE__ */ e("p", { style: { marginBottom: "1.5rem", fontSize: "0.875rem", opacity: 0.7 }, children: "Configure webhook endpoint for receiving purchase notifications." }),
281
328
  !s.webhook_enabled && /* @__PURE__ */ e(
282
329
  "div",
@@ -301,7 +348,7 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
301
348
  type: "url",
302
349
  className: "cedros-admin__input",
303
350
  value: s.webhook_url,
304
- onChange: (a) => o("webhook_url", a.target.value),
351
+ onChange: (a) => n("webhook_url", a.target.value),
305
352
  placeholder: "https://api.yoursite.com/webhooks/orders",
306
353
  disabled: !s.webhook_enabled
307
354
  }
@@ -314,8 +361,8 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
314
361
  {
315
362
  type: "password",
316
363
  className: "cedros-admin__input",
317
- value: h.has("webhook_secret") ? s.webhook_secret : "",
318
- onChange: (a) => o("webhook_secret", a.target.value),
364
+ value: b.has("webhook_secret") ? s.webhook_secret : "",
365
+ onChange: (a) => n("webhook_secret", a.target.value),
319
366
  placeholder: s.webhook_secret ? "••••••••" : "Enter secret for HMAC-SHA256",
320
367
  disabled: !s.webhook_enabled
321
368
  }
@@ -330,7 +377,7 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
330
377
  type: "number",
331
378
  className: "cedros-admin__input",
332
379
  value: s.webhook_timeout,
333
- onChange: (a) => o("webhook_timeout", parseInt(a.target.value) || 30),
380
+ onChange: (a) => n("webhook_timeout", parseInt(a.target.value) || 30),
334
381
  placeholder: "30",
335
382
  disabled: !s.webhook_enabled,
336
383
  style: { maxWidth: 120 }
@@ -343,5 +390,5 @@ function U({ serverUrl: _, apiKey: n, authManager: r }) {
343
390
  ] });
344
391
  }
345
392
  export {
346
- U as MessagingSection
393
+ V as MessagingSection
347
394
  };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as i, jsx as e, Fragment as s } from "react/jsx-runtime";
2
2
  import { useState as h } from "react";
3
- import { S as m } from "./SingleCategorySettings-Cwlehl0u.mjs";
3
+ import { S as m } from "./SingleCategorySettings-BU98SRFV.mjs";
4
4
  function r({ href: o, children: a }) {
5
5
  return /* @__PURE__ */ e(
6
6
  "a",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),p=require("./SingleCategorySettings-BTXR7zex.js");function r({href:s,children:n}){return e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"},children:n})}const a=[{id:"stripe",label:"Stripe",category:"stripe",description:e.jsxs(e.Fragment,{children:["Configure your Stripe integration for card payments. Get your API keys from the"," ",e.jsx(r,{href:"https://dashboard.stripe.com/apikeys",children:"Stripe Dashboard"}),"."]})},{id:"crypto",label:"Crypto",category:"x402",description:e.jsxs(e.Fragment,{children:["Configure Solana wallet and token settings for crypto payments. Get a fast RPC endpoint from"," ",e.jsx(r,{href:"https://www.helius.dev",children:"Helius"})," or"," ",e.jsx(r,{href:"https://www.quicknode.com/chains/sol",children:"QuickNode"}),". Set up a payment address using"," ",e.jsx(r,{href:"https://phantom.app",children:"Phantom"})," or"," ",e.jsx(r,{href:"https://solflare.com",children:"Solflare"})," wallet."]})},{id:"credits",label:"Credits",category:"cedros_login",description:e.jsxs(e.Fragment,{children:["Configure Cedros Login integration for credits payments. See the"," ",e.jsx(r,{href:"https://docs.cedros.dev/credits",children:"Credits API documentation"}),"."]})}];function h({serverUrl:s,apiKey:n,authManager:c}){const[o,d]=l.useState("stripe"),i=a.find(t=>t.id===o);return e.jsxs("div",{className:"cedros-admin__payment-settings",children:[e.jsxs("div",{className:"cedros-admin__page-header",children:[e.jsx("h2",{className:"cedros-admin__page-title",children:"Payment Options"}),e.jsx("p",{className:"cedros-admin__page-description",children:"Configure payment methods including Stripe, crypto, and credits."})]}),e.jsx("div",{className:"cedros-admin__tabs cedros-admin__tabs--line",children:a.map(t=>e.jsx("button",{type:"button",className:`cedros-admin__tab ${o===t.id?"cedros-admin__tab--active":""}`,onClick:()=>d(t.id),children:t.label},t.id))}),e.jsx("div",{style:{marginTop:"1rem"},children:e.jsx(p.SingleCategorySettings,{serverUrl:s,apiKey:n,authManager:c,category:i.category,title:`${i.label} Settings`,description:i.description,showEnabledToggle:!0},i.category)})]})}exports.PaymentSettingsSection=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),p=require("./SingleCategorySettings-DqcXe-q4.js");function r({href:s,children:n}){return e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"},children:n})}const a=[{id:"stripe",label:"Stripe",category:"stripe",description:e.jsxs(e.Fragment,{children:["Configure your Stripe integration for card payments. Get your API keys from the"," ",e.jsx(r,{href:"https://dashboard.stripe.com/apikeys",children:"Stripe Dashboard"}),"."]})},{id:"crypto",label:"Crypto",category:"x402",description:e.jsxs(e.Fragment,{children:["Configure Solana wallet and token settings for crypto payments. Get a fast RPC endpoint from"," ",e.jsx(r,{href:"https://www.helius.dev",children:"Helius"})," or"," ",e.jsx(r,{href:"https://www.quicknode.com/chains/sol",children:"QuickNode"}),". Set up a payment address using"," ",e.jsx(r,{href:"https://phantom.app",children:"Phantom"})," or"," ",e.jsx(r,{href:"https://solflare.com",children:"Solflare"})," wallet."]})},{id:"credits",label:"Credits",category:"cedros_login",description:e.jsxs(e.Fragment,{children:["Configure Cedros Login integration for credits payments. See the"," ",e.jsx(r,{href:"https://docs.cedros.dev/credits",children:"Credits API documentation"}),"."]})}];function h({serverUrl:s,apiKey:n,authManager:c}){const[o,d]=l.useState("stripe"),i=a.find(t=>t.id===o);return e.jsxs("div",{className:"cedros-admin__payment-settings",children:[e.jsxs("div",{className:"cedros-admin__page-header",children:[e.jsx("h2",{className:"cedros-admin__page-title",children:"Payment Options"}),e.jsx("p",{className:"cedros-admin__page-description",children:"Configure payment methods including Stripe, crypto, and credits."})]}),e.jsx("div",{className:"cedros-admin__tabs cedros-admin__tabs--line",children:a.map(t=>e.jsx("button",{type:"button",className:`cedros-admin__tab ${o===t.id?"cedros-admin__tab--active":""}`,onClick:()=>d(t.id),children:t.label},t.id))}),e.jsx("div",{style:{marginTop:"1rem"},children:e.jsx(p.SingleCategorySettings,{serverUrl:s,apiKey:n,authManager:c,category:i.category,title:`${i.label} Settings`,description:i.description,showEnabledToggle:!0},i.category)})]})}exports.PaymentSettingsSection=h;
@@ -1,6 +1,6 @@
1
1
  import { jsxs as n, jsx as i } from "react/jsx-runtime";
2
2
  import { useState as g } from "react";
3
- import { S as l } from "./SingleCategorySettings-Cwlehl0u.mjs";
3
+ import { S as l } from "./SingleCategorySettings-BU98SRFV.mjs";
4
4
  const s = [
5
5
  {
6
6
  id: "logging",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),g=require("./SingleCategorySettings-BTXR7zex.js"),n=[{id:"logging",label:"Logging",category:"logging",description:"Configure log levels, format, and environment settings."},{id:"metrics",label:"Metrics",category:"metrics",description:"Configure metrics collection and API access for monitoring."},{id:"security",label:"Security",category:"security",description:"Configure CORS, rate limiting, and other security settings."}];function l({serverUrl:r,apiKey:c,authManager:o}){const[s,a]=d.useState("logging"),t=n.find(i=>i.id===s);return e.jsxs("div",{className:"cedros-admin__server-settings",children:[e.jsxs("div",{className:"cedros-admin__page-header",children:[e.jsx("h2",{className:"cedros-admin__page-title",children:"Store Server"}),e.jsx("p",{className:"cedros-admin__page-description",children:"Configure logging, metrics, and security settings."})]}),e.jsx("div",{className:"cedros-admin__tabs cedros-admin__tabs--line",children:n.map(i=>e.jsx("button",{type:"button",className:`cedros-admin__tab ${s===i.id?"cedros-admin__tab--active":""}`,onClick:()=>a(i.id),children:i.label},i.id))}),e.jsx("div",{style:{marginTop:"1rem"},children:e.jsx(g.SingleCategorySettings,{serverUrl:r,apiKey:c,authManager:o,category:t.category,title:`${t.label} Settings`,description:t.description},t.category)})]})}exports.SettingsSection=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),g=require("./SingleCategorySettings-DqcXe-q4.js"),n=[{id:"logging",label:"Logging",category:"logging",description:"Configure log levels, format, and environment settings."},{id:"metrics",label:"Metrics",category:"metrics",description:"Configure metrics collection and API access for monitoring."},{id:"security",label:"Security",category:"security",description:"Configure CORS, rate limiting, and other security settings."}];function l({serverUrl:r,apiKey:c,authManager:o}){const[s,a]=d.useState("logging"),t=n.find(i=>i.id===s);return e.jsxs("div",{className:"cedros-admin__server-settings",children:[e.jsxs("div",{className:"cedros-admin__page-header",children:[e.jsx("h2",{className:"cedros-admin__page-title",children:"Store Server"}),e.jsx("p",{className:"cedros-admin__page-description",children:"Configure logging, metrics, and security settings."})]}),e.jsx("div",{className:"cedros-admin__tabs cedros-admin__tabs--line",children:n.map(i=>e.jsx("button",{type:"button",className:`cedros-admin__tab ${s===i.id?"cedros-admin__tab--active":""}`,onClick:()=>a(i.id),children:i.label},i.id))}),e.jsx("div",{style:{marginTop:"1rem"},children:e.jsx(g.SingleCategorySettings,{serverUrl:r,apiKey:c,authManager:o,category:t.category,title:`${t.label} Settings`,description:t.description},t.category)})]})}exports.SettingsSection=l;