@cedros/pay-react 1.1.16 → 1.1.18

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 (149) hide show
  1. package/dist/AISettingsSection-C-thWh51.js +51 -0
  2. package/dist/AISettingsSection-CD9IRyR1.mjs +539 -0
  3. package/dist/AutosaveIndicator-DxemlKnX.js +1 -0
  4. package/dist/AutosaveIndicator-G2CRN8hH.mjs +35 -0
  5. package/dist/{CedrosContext-D7nh5-Zh.mjs → CedrosContext-BnJ2Cf7R.mjs} +1179 -642
  6. package/dist/CedrosContext-C26DlvLF.js +6 -0
  7. package/dist/CryptoButton-BdOtL7w-.mjs +542 -0
  8. package/dist/CryptoButton-N8kRfNDO.js +1 -0
  9. package/dist/FAQSection-CyYK9OAN.mjs +366 -0
  10. package/dist/FAQSection-_pm1ekTe.js +1 -0
  11. package/dist/MessagingSection-BHzf1Mhu.js +1 -0
  12. package/dist/MessagingSection-DO2yPTvs.mjs +347 -0
  13. package/dist/PaymentSettingsSection--Aqlne1F.mjs +94 -0
  14. package/dist/PaymentSettingsSection-DpENgoca.js +1 -0
  15. package/dist/SettingsSection-CGKKGXWz.mjs +57 -0
  16. package/dist/SettingsSection-DNoODw7i.js +1 -0
  17. package/dist/SingleCategorySettings-8DCtLcow.mjs +1421 -0
  18. package/dist/SingleCategorySettings-NLBYxM0O.js +3 -0
  19. package/dist/StorefrontSection-BEOMtSAg.js +1 -0
  20. package/dist/StorefrontSection-Mzr1H51w.mjs +765 -0
  21. package/dist/SubscriptionsSection-4b29i-41.js +1 -0
  22. package/dist/SubscriptionsSection-Dy1e15fe.mjs +616 -0
  23. package/dist/Toggle-CsPSF8Dr.js +1 -0
  24. package/dist/Toggle-DAxIdpY4.mjs +48 -0
  25. package/dist/WalletManager-D6BYTwXn.js +1 -0
  26. package/dist/{WalletManager-oEjZhaFk.mjs → WalletManager-HXXyARQ7.mjs} +36 -32
  27. package/dist/components/CedrosPay.d.ts.map +1 -1
  28. package/dist/components/CryptoSubscribeButton.d.ts.map +1 -1
  29. package/dist/components/PaymentModal.d.ts.map +1 -1
  30. package/dist/components/SubscriptionManagementPanel.d.ts.map +1 -1
  31. package/dist/components/admin/AISettingsSection.d.ts.map +1 -1
  32. package/dist/components/admin/AdminAuthManager.d.ts +2 -1
  33. package/dist/components/admin/AdminAuthManager.d.ts.map +1 -1
  34. package/dist/components/admin/AutosaveIndicator.d.ts +7 -0
  35. package/dist/components/admin/AutosaveIndicator.d.ts.map +1 -0
  36. package/dist/components/admin/CedrosPayAdminDashboard.d.ts.map +1 -1
  37. package/dist/components/admin/ConfigEditor.d.ts +0 -2
  38. package/dist/components/admin/ConfigEditor.d.ts.map +1 -1
  39. package/dist/components/admin/MessagingSection.d.ts.map +1 -1
  40. package/dist/components/admin/ProductsSection.d.ts.map +1 -1
  41. package/dist/components/admin/RefundsSection.d.ts.map +1 -1
  42. package/dist/components/admin/SecretArrayEditor.d.ts +16 -0
  43. package/dist/components/admin/SecretArrayEditor.d.ts.map +1 -0
  44. package/dist/components/admin/SingleCategorySettings.d.ts.map +1 -1
  45. package/dist/components/admin/StorefrontSection.d.ts.map +1 -1
  46. package/dist/components/admin/Toggle.d.ts +14 -0
  47. package/dist/components/admin/Toggle.d.ts.map +1 -0
  48. package/dist/components/admin/TokenMintSelector.d.ts +27 -0
  49. package/dist/components/admin/TokenMintSelector.d.ts.map +1 -0
  50. package/dist/components/admin/configApi.d.ts +5 -3
  51. package/dist/components/admin/configApi.d.ts.map +1 -1
  52. package/dist/components/admin/index.d.ts +8 -9
  53. package/dist/components/admin/index.d.ts.map +1 -1
  54. package/dist/components/admin/sections-more.d.ts +2 -9
  55. package/dist/components/admin/sections-more.d.ts.map +1 -1
  56. package/dist/context/CedrosContext.d.ts +1 -1
  57. package/dist/context/CedrosContext.d.ts.map +1 -1
  58. package/dist/crypto-only.js +1 -1
  59. package/dist/crypto-only.mjs +391 -380
  60. package/dist/ecommerce/__tests__/inventoryHooks.test.d.ts +2 -0
  61. package/dist/ecommerce/__tests__/inventoryHooks.test.d.ts.map +1 -0
  62. package/dist/ecommerce/__tests__/storage.test.d.ts +2 -0
  63. package/dist/ecommerce/__tests__/storage.test.d.ts.map +1 -0
  64. package/dist/ecommerce/adapters/CommerceAdapter.d.ts +5 -0
  65. package/dist/ecommerce/adapters/CommerceAdapter.d.ts.map +1 -1
  66. package/dist/ecommerce/adapters/mock/mockAdapter.d.ts.map +1 -1
  67. package/dist/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -1
  68. package/dist/ecommerce/adapters/paywall/paywallAdapter.test.d.ts +2 -0
  69. package/dist/ecommerce/adapters/paywall/paywallAdapter.test.d.ts.map +1 -0
  70. package/dist/ecommerce/components/catalog/ProductCard.d.ts.map +1 -1
  71. package/dist/ecommerce/components/catalog/QuickViewDialog.d.ts.map +1 -1
  72. package/dist/ecommerce/components/chat/ShopChatPanel.d.ts +4 -0
  73. package/dist/ecommerce/components/chat/ShopChatPanel.d.ts.map +1 -1
  74. package/dist/ecommerce/components/checkout/PaymentStep.d.ts.map +1 -1
  75. package/dist/ecommerce/components/faq/FAQItem.d.ts.map +1 -1
  76. package/dist/ecommerce/config/context.d.ts.map +1 -1
  77. package/dist/ecommerce/hooks/useAIRelatedProducts.d.ts.map +1 -1
  78. package/dist/ecommerce/hooks/useCartInventory.d.ts.map +1 -1
  79. package/dist/ecommerce/hooks/useHoldExpiry.d.ts.map +1 -1
  80. package/dist/ecommerce/hooks/useInventoryVerification.d.ts.map +1 -1
  81. package/dist/ecommerce/hooks/useProducts.d.ts.map +1 -1
  82. package/dist/ecommerce/index.d.ts +2 -0
  83. package/dist/ecommerce/index.d.ts.map +1 -1
  84. package/dist/ecommerce/integrations/cedros-pay/useCedrosPayCheckoutAdapter.d.ts.map +1 -1
  85. package/dist/ecommerce/state/cart/CartProvider.d.ts.map +1 -1
  86. package/dist/ecommerce/state/checkout/checkoutSchema.d.ts +1 -1
  87. package/dist/ecommerce/state/checkout/useCheckout.d.ts.map +1 -1
  88. package/dist/ecommerce/templates/ProductTemplate.d.ts.map +1 -1
  89. package/dist/ecommerce/utils/storage.d.ts +1 -1
  90. package/dist/ecommerce/utils/storage.d.ts.map +1 -1
  91. package/dist/hooks/useCreditsPayment.d.ts.map +1 -1
  92. package/dist/hooks/useCreditsSubscription.d.ts.map +1 -1
  93. package/dist/hooks/useCryptoSubscription.d.ts.map +1 -1
  94. package/dist/hooks/useRefundVerification.d.ts.map +1 -1
  95. package/dist/hooks/useStripeCheckout.d.ts +1 -1
  96. package/dist/hooks/useStripeCheckout.d.ts.map +1 -1
  97. package/dist/hooks/useSubscription.d.ts.map +1 -1
  98. package/dist/hooks/useSubscriptionManagement.d.ts.map +1 -1
  99. package/dist/hooks/useX402Payment.d.ts.map +1 -1
  100. package/dist/index-B-0trqeD.js +84 -0
  101. package/dist/index-bbSf3B7-.mjs +22915 -0
  102. package/dist/index.js +1 -1
  103. package/dist/index.mjs +67 -72
  104. package/dist/managers/CreditsManager.d.ts +6 -0
  105. package/dist/managers/CreditsManager.d.ts.map +1 -1
  106. package/dist/managers/ManagerCache.d.ts.map +1 -1
  107. package/dist/managers/RouteDiscoveryManager.d.ts +3 -0
  108. package/dist/managers/RouteDiscoveryManager.d.ts.map +1 -1
  109. package/dist/managers/StripeManager.d.ts +15 -0
  110. package/dist/managers/StripeManager.d.ts.map +1 -1
  111. package/dist/managers/SubscriptionChangeManager.d.ts.map +1 -1
  112. package/dist/managers/SubscriptionManager.d.ts +7 -14
  113. package/dist/managers/SubscriptionManager.d.ts.map +1 -1
  114. package/dist/managers/WalletManager.d.ts +2 -1
  115. package/dist/managers/WalletManager.d.ts.map +1 -1
  116. package/dist/managers/X402Manager.d.ts.map +1 -1
  117. package/dist/{sections-CL3lbNui.js → sections-CKwGmrzV.js} +1 -1
  118. package/dist/{sections-DnmB0qdx.mjs → sections-DpEdFL1B.mjs} +1 -1
  119. package/dist/stripe-only.js +1 -1
  120. package/dist/stripe-only.mjs +67 -72
  121. package/dist/telemetry.js +1 -1
  122. package/dist/telemetry.mjs +23 -25
  123. package/dist/testing/index.js +1 -1
  124. package/dist/testing/index.mjs +1 -1
  125. package/dist/types/index.d.ts +13 -2
  126. package/dist/types/index.d.ts.map +1 -1
  127. package/dist/useAutosave-B2p6iwh8.js +1 -0
  128. package/dist/useAutosave-YwMqRzqy.mjs +44 -0
  129. package/dist/utils/circuitBreaker.d.ts +3 -1
  130. package/dist/utils/circuitBreaker.d.ts.map +1 -1
  131. package/dist/utils/cspHelper.d.ts +6 -0
  132. package/dist/utils/cspHelper.d.ts.map +1 -1
  133. package/dist/utils/csvHelpers.d.ts +0 -41
  134. package/dist/utils/csvHelpers.d.ts.map +1 -1
  135. package/dist/utils/errorHandling.d.ts.map +1 -1
  136. package/dist/utils/exponentialBackoff.d.ts.map +1 -1
  137. package/dist/utils/requestDeduplication.d.ts.map +1 -1
  138. package/dist/utils/telemetry.d.ts.map +1 -1
  139. package/dist/utils/validateConfig.d.ts +1 -1
  140. package/dist/utils/validateConfig.d.ts.map +1 -1
  141. package/dist/walletDetection-JZR3UCOa.mjs +27 -0
  142. package/dist/walletDetection-bNmV5ItZ.js +1 -0
  143. package/dist/{walletPool-BR6etEiq.mjs → walletPool-BV_z1lEA.mjs} +1 -1
  144. package/dist/{walletPool-BZyAG4YS.js → walletPool-DjA7J3a9.js} +1 -1
  145. package/package.json +8 -7
  146. package/dist/CedrosContext-C2v_s8cc.js +0 -6
  147. package/dist/WalletManager-B5KLZK2D.js +0 -1
  148. package/dist/index-BU0vgA-7.js +0 -136
  149. package/dist/index-DWXEBUbu.mjs +0 -27912
@@ -0,0 +1,3 @@
1
+ "use strict";const e=require("react/jsx-runtime"),m=require("react"),w=require("./index-B-0trqeD.js"),J=require("./useAutosave-B2p6iwh8.js"),$=require("./AutosaveIndicator-DxemlKnX.js"),P=require("./CedrosContext-C26DlvLF.js"),G=require("@solana/web3.js");class Y{constructor(i,a,n){this._serverUrl=i,this.auth=a,this.authManager=n}get serverUrl(){return this._serverUrl}async fetch(i,a={}){if(this.authManager?.isAuthenticated())return this.authManager.fetchWithAuth(i,a);throw this.auth?new Error("Legacy AdminAuth is no longer supported due to replay vulnerability. Use IAdminAuthManager instead."):new Error("Admin authentication required. Provide an IAdminAuthManager to ConfigApi.")}async listCategories(i=100){return this.fetch(`/admin/config?limit=${i}`)}async getConfig(i,a=!0){return this.fetch(`/admin/config/${i}?redact_secrets=${a}`)}async updateConfig(i,a,n){await this.fetch(`/admin/config/${i}`,{method:"PUT",body:JSON.stringify({config:a,description:n})})}async patchConfig(i,a,n){await this.fetch(`/admin/config/${i}`,{method:"PATCH",body:JSON.stringify({updates:a,description:n})})}async batchUpdate(i){await this.fetch("/admin/config/batch",{method:"POST",body:JSON.stringify({updates:i})})}async validateConfig(i,a){return this.fetch("/admin/config/validate",{method:"POST",body:JSON.stringify({category:i,config:a})})}async getHistory(i,a=50){const n=new URLSearchParams({limit:a.toString()});return i&&n.set("category",i),this.fetch(`/admin/config/history?${n}`)}}const O={server:{label:"Server",secrets:[],icon:"🖥️",fields:{admin_metrics_api_key:{hidden:!0},cors_allowed_origins:{hidden:!0}}},security:{label:"Security",description:"Configure CORS, rate limiting, and other security settings",secrets:[],icon:"🔒",fields:{cors_allowed_origins:{description:'List of allowed origins for CORS requests. Use ["*"] to allow all origins (not recommended for production).'}}},metrics:{label:"Metrics",description:"Configure metrics collection and API access",secrets:["admin_metrics_api_key"],icon:"📊",fields:{admin_metrics_api_key:{description:"API key for accessing the admin metrics endpoint. Keep this secret."}}},logging:{label:"Logging",secrets:[],icon:"📝",fields:{level:{type:"dropdown",options:["trace","debug","info","warn","error"]},format:{hidden:!0},environment:{hidden:!0}}},stripe:{label:"Stripe",secrets:["secret_key","webhook_secret"],icon:"💳",fields:{enabled:{hidden:!0},secret_key:{description:"Stripe Dashboard → Developers → API keys → Secret key. Use the test key (sk_test_...) for testing, or the live key (sk_live_...) for production."},publishable_key:{description:"Stripe Dashboard → Developers → API keys → Publishable key. Starts with pk_test_... or pk_live_..."},mode:{type:"dropdown",options:["test","live"],description:'Use "test" mode with test API keys during development, then switch to "live" with live keys for real payments.'},webhook_url:{description:"The full URL Stripe sends webhook events to. Default is your server URL + /webhook/stripe (e.g. https://example.com/webhook/stripe). Only change this if you've customized the route in your cedros-pay server."},webhook_secret:{description:`Stripe Dashboard → Developers → Webhooks → "Create an event destination" → select events: checkout.session.completed, customer.subscription.created, customer.subscription.updated, customer.subscription.deleted, invoice.paid, invoice.payment_failed → Continue → choose "Webhook endpoint" → enter your server's webhook endpoint, e.g. https://example.com/webhook/stripe (your server URL + /webhook/stripe) → after creating, click the endpoint and "Click to reveal" the signing secret. Starts with whsec_...`},tax_rate_id:{description:`Stripe Dashboard → More → Product catalog → Tax rates → "+ New" → set the percentage, region, and whether tax is inclusive or exclusive → Save → copy the tax rate ID from the detail page (starts with txr_...). Leave empty if you don't collect tax.`},success_url:{hidden:!0},cancel_url:{hidden:!0}}},x402:{label:"X402 (Crypto)",secrets:["server_wallets"],icon:"⚡",fields:{enabled:{hidden:!0},payment_address:{type:"solana_address",description:"The Solana wallet address where payments are received. This is where customer funds are sent."},token_mint:{type:"token_mint",description:"The SPL token used for payments. Most commonly USDC."},token_decimals:{type:"number",description:"Number of decimal places for the token (e.g., USDC has 6 decimals).",hidden:!0},custom_token_symbol:{description:'Display symbol for your custom token (e.g., "MYTOKEN").',hidden:!0},custom_token_icon:{description:"URL to your token's icon image.",hidden:!0},rpc_url:{description:"Custom Solana RPC endpoint. Leave empty to use the default public RPC."},gasless_enabled:{type:"toggle",description:"When enabled, your server pays transaction fees so customers don't need SOL."},server_wallets:{type:"secret_array",description:"Server keypair(s) used to sign and pay for transactions. Required for gasless payments.",showWhen:"gasless_enabled"},rounding_mode:{type:"dropdown",options:["nearest","up","down"],description:"How to round fractional token amounts: nearest (default), up (always round up), or down (always round down)."},network:{hidden:!0},ws_url:{hidden:!0},skip_preflight:{hidden:!0},commitment:{hidden:!0},compute_unit_limit:{hidden:!0},compute_unit_price:{hidden:!0}}},paywall:{label:"Paywall",secrets:[],icon:"🚪",fields:{product_cache_ttl:{type:"number",unit:"seconds"}}},coupons:{label:"Coupons",secrets:[],icon:"🎟️",fields:{cache_ttl:{type:"number",unit:"seconds"}}},subscriptions:{label:"Subscriptions",secrets:[],icon:"🔄",fields:{grace_period_hours:{type:"number",unit:"hours"}}},callbacks:{label:"Callbacks",secrets:["hmac_secret"],icon:"🔔"},email:{label:"Email",description:"Email receipts for customers after purchase",secrets:["smtp_password"],icon:"📧",fields:{enabled:{hidden:!0},provider:{type:"dropdown",options:["sendgrid","mailgun","postmark","ses","resend","custom"],description:"Email service provider."},smtp_host:{description:"SMTP server hostname.",showWhen:"provider"},smtp_port:{type:"number",description:"SMTP server port (typically 587 for TLS).",showWhen:"provider"},smtp_user:{description:"SMTP authentication username or API key name.",showWhen:"provider"},smtp_password:{description:"SMTP password or API key.",showWhen:"provider"},from_address:{description:"Sender email address (e.g., orders@yourstore.com)."},from_name:{description:'Sender display name (e.g., "Your Store").'}}},webhook:{label:"Webhook",description:"HTTP notifications when purchases occur",secrets:["secret"],icon:"🔔",fields:{enabled:{hidden:!0},url:{description:"URL to receive POST notifications (e.g., https://api.yoursite.com/webhooks/orders)."},secret:{description:"Shared secret for HMAC-SHA256 signature verification."},retry_attempts:{type:"number",description:"Number of retry attempts on failure (default: 3)."}}},messaging:{label:"Messaging",description:"Email and webhook notifications for purchases",secrets:["smtp_password","webhook_secret"],icon:"📬",fields:{email_enabled:{type:"boolean",description:"Send order confirmation emails to customers."},smtp_host:{description:"SMTP server hostname.",showWhen:"email_enabled"},smtp_port:{type:"number",description:"SMTP server port (typically 587 for TLS).",showWhen:"email_enabled"},smtp_username:{description:"SMTP authentication username or API key.",showWhen:"email_enabled"},smtp_password:{description:"SMTP password or API key.",showWhen:"email_enabled"},from_email:{description:"Sender email address (e.g., orders@yourstore.com).",showWhen:"email_enabled"},from_name:{description:'Sender display name (e.g., "Your Store").',showWhen:"email_enabled"},webhook_enabled:{type:"boolean",description:"Send webhook notifications when purchases complete."},webhook_url:{description:"URL to receive POST notifications.",showWhen:"webhook_enabled"},webhook_secret:{description:"Shared secret for HMAC-SHA256 signature verification.",showWhen:"webhook_enabled"},webhook_timeout:{type:"number",description:"Request timeout in seconds (default: 30).",showWhen:"webhook_enabled"}}},monitoring:{label:"Monitoring",secrets:[],icon:"📊",fields:{check_interval:{type:"number",unit:"seconds"},low_balance_threshold:{type:"number",unit:"SOL"}}},rate_limit:{label:"Rate Limiting",secrets:[],icon:"⏱️"},circuit_breaker:{label:"Circuit Breaker",secrets:[],icon:"🔌"},admin:{label:"Admin Keys",secrets:[],icon:"👤"},api_keys:{label:"API Keys",secrets:[],icon:"🔐"},cedros_login:{label:"Cedros Login",secrets:["api_key"],icon:"🔑",fields:{enabled:{hidden:!0},credits_enabled:{hidden:!0},base_url:{hidden:!0},timeout:{hidden:!0},jwt_issuer:{hidden:!0},jwt_audience:{hidden:!0}}},shop:{label:"Storefront",description:"Product pages & display settings",secrets:[],icon:"🏪",fields:{enabled:{hidden:!0},"relatedProducts.mode":{type:"dropdown",options:["most_recent","by_category","manual","ai"]},"relatedProducts.maxItems":{type:"number"}}}};function F(b,i){return O[b]?.secrets.includes(i)??!1}const D="[REDACTED]";function W(b){if(!b||b.trim()==="")return{valid:!0};try{return new G.PublicKey(b.trim()),{valid:!0}}catch{return{valid:!1,error:"Invalid Solana address"}}}function X({label:b,value:i,onChange:a,decimals:n,onDecimalsChange:S,disabled:d=!1,description:c,customSymbol:l="",customIcon:h="",onCustomSymbolChange:u,onCustomIconChange:y}){const[x,N]=m.useState(!1),f=Object.entries(P.STABLECOIN_METADATA),_=!!P.STABLECOIN_METADATA[i],j=x||!!i&&!_,k=t=>{if(t==="custom")N(!0),_&&a("");else{N(!1),a(t);const s=P.STABLECOIN_METADATA[t];s&&S&&S(s.decimals),u&&u(""),y&&y("")}};return e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:b}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.5rem"},children:[f.map(([t,s])=>e.jsxs("button",{type:"button",onClick:()=>k(t),disabled:d,style:{display:"flex",alignItems:"center",gap:"0.5rem",padding:"0.5rem 0.75rem",border:i===t?"2px solid var(--cedros-admin-primary, #171717)":"1px solid var(--cedros-admin-border, #d4d4d4)",borderRadius:"0.5rem",background:i===t?"var(--cedros-admin-primary-bg, #f5f5f5)":"var(--cedros-admin-bg, #fff)",cursor:d?"not-allowed":"pointer",opacity:d?.5:1,fontWeight:i===t?600:400},children:[e.jsx("img",{src:s.icon,alt:s.symbol,style:{width:20,height:20,borderRadius:"50%"},onError:r=>{r.target.style.display="none"}}),e.jsx("span",{children:s.symbol})]},t)),e.jsxs("button",{type:"button",onClick:()=>k("custom"),disabled:d,style:{display:"flex",alignItems:"center",gap:"0.5rem",padding:"0.5rem 0.75rem",border:j?"2px solid var(--cedros-admin-primary, #171717)":"1px solid var(--cedros-admin-border, #d4d4d4)",borderRadius:"0.5rem",background:j?"var(--cedros-admin-primary-bg, #f5f5f5)":"var(--cedros-admin-bg, #fff)",cursor:d?"not-allowed":"pointer",opacity:d?.5:1,fontWeight:j?600:400},children:[e.jsx("span",{style:{fontSize:"1rem"},children:"+"}),e.jsx("span",{children:"Custom"})]})]}),j&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem",padding:"1rem",background:"var(--cedros-admin-bg-muted, #f9fafb)",borderRadius:"0.5rem",border:"1px solid var(--cedros-admin-border, #e5e7eb)"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.75rem",fontWeight:500,marginBottom:"0.25rem",color:"var(--cedros-admin-text-muted, #64748b)"},children:"Token Mint Address"}),(()=>{const t=W(i);return e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",className:`cedros-admin__input ${t.valid?"":"cedros-admin__input--error"}`,value:i,onChange:s=>a(s.target.value),placeholder:"e.g., EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",disabled:d,style:{fontFamily:"monospace",fontSize:"0.875rem",borderColor:t.valid?void 0:"var(--cedros-admin-error, #dc2626)"}}),!t.valid&&e.jsx("span",{style:{color:"var(--cedros-admin-error, #dc2626)",fontSize:"0.75rem",marginTop:"0.25rem",display:"block"},children:t.error})]})})()]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.75rem",fontWeight:500,marginBottom:"0.25rem",color:"var(--cedros-admin-text-muted, #64748b)"},children:"Token Symbol"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:l,onChange:t=>u?.(t.target.value),placeholder:"e.g., MYTOKEN",disabled:d,style:{textTransform:"uppercase"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.75rem",fontWeight:500,marginBottom:"0.25rem",color:"var(--cedros-admin-text-muted, #64748b)"},children:"Token Icon URL"}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[e.jsx("input",{type:"text",className:"cedros-admin__input",value:h,onChange:t=>y?.(t.target.value),placeholder:"https://example.com/token-logo.png",disabled:d,style:{flex:1}}),h&&e.jsx("img",{src:h,alt:"Token icon preview",style:{width:32,height:32,borderRadius:"50%",border:"1px solid var(--cedros-admin-border, #e5e7eb)",objectFit:"cover"},onError:t=>{t.target.style.display="none"}})]}),e.jsx("div",{style:{fontSize:"0.7rem",color:"var(--cedros-admin-text-muted, #94a3b8)",marginTop:"0.25rem"},children:"Shown to customers during checkout"})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.75rem",fontWeight:500,marginBottom:"0.25rem",color:"var(--cedros-admin-text-muted, #64748b)"},children:"Token Decimals"}),e.jsx("input",{type:"number",className:"cedros-admin__input",value:n??6,onChange:t=>S?.(parseInt(t.target.value,10)||0),min:0,max:18,disabled:d,style:{width:"100px"}}),e.jsx("div",{style:{fontSize:"0.7rem",color:"var(--cedros-admin-text-muted, #94a3b8)",marginTop:"0.25rem"},children:"Most SPL tokens use 6 decimals (like USDC)"})]})]}),i&&_&&e.jsx("div",{style:{fontSize:"0.75rem",color:"var(--cedros-admin-text-muted, #64748b)",fontFamily:"monospace",wordBreak:"break-all"},children:i}),c&&e.jsx("div",{style:{fontSize:"0.75rem",color:"var(--cedros-admin-text-muted, #64748b)",marginTop:"0.25rem"},children:c})]})]})}function Z({label:b,value:i,onChange:a,disabled:n=!1,description:S}){const[d,c]=m.useState(new Set),[l,h]=m.useState(null),[u,y]=m.useState(""),x=Array.isArray(i)?i:[],N=t=>{c(s=>{const r=new Set(s);return r.has(t)?r.delete(t):r.add(t),r})},f=()=>{a([...x,""]),h(x.length),y("")},E=(t,s)=>{const r=[...x];r[t]=s,a(r)},_=t=>{const s=x.filter((r,g)=>g!==t);a(s),c(r=>{const g=new Set;return r.forEach(v=>{v<t?g.add(v):v>t&&g.add(v-1)}),g})},A=t=>{h(t),y(x[t]||"")},j=()=>{l!==null&&(E(l,u),h(null),y(""))},k=()=>{l!==null&&x[l]===""&&_(l),h(null),y("")};return e.jsxs("div",{className:"cedros-admin__field",children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.5rem"},children:[e.jsx("label",{className:"cedros-admin__field-label",style:{marginBottom:0},children:b}),e.jsxs("button",{type:"button",onClick:f,disabled:n,style:{display:"flex",alignItems:"center",gap:"0.25rem",padding:"0.25rem 0.5rem",fontSize:"0.75rem",border:"1px solid var(--cedros-admin-border, #d4d4d4)",borderRadius:"0.375rem",background:"var(--cedros-admin-bg, #fff)",cursor:n?"not-allowed":"pointer",opacity:n?.5:1},children:[w.Icons.plus,"Add"]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[x.length===0&&e.jsx("div",{style:{padding:"1rem",textAlign:"center",color:"var(--cedros-admin-text-muted, #64748b)",fontSize:"0.875rem",border:"1px dashed var(--cedros-admin-border, #d4d4d4)",borderRadius:"0.5rem"},children:'No items. Click "Add" to create one.'}),x.map((t,s)=>{const r=d.has(s),g=l===s,v=t===D;return e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",padding:"0.5rem",background:"var(--cedros-admin-bg-muted, #f9fafb)",borderRadius:"0.375rem",border:"1px solid var(--cedros-admin-border, #e5e7eb)"},children:g?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",className:"cedros-admin__input",value:u,onChange:o=>y(o.target.value),placeholder:"Enter wallet keypair...",autoFocus:!0,style:{flex:1,fontFamily:"monospace",fontSize:"0.75rem"},onKeyDown:o=>{o.key==="Enter"&&j(),o.key==="Escape"&&k()}}),e.jsx("button",{type:"button",onClick:j,style:{padding:"0.375rem",border:"none",background:"var(--cedros-admin-success, #22c55e)",color:"#fff",borderRadius:"0.25rem",cursor:"pointer"},title:"Save",children:w.Icons.check}),e.jsx("button",{type:"button",onClick:k,style:{padding:"0.375rem",border:"none",background:"var(--cedros-admin-text-muted, #64748b)",color:"#fff",borderRadius:"0.25rem",cursor:"pointer"},title:"Cancel",children:w.Icons.close})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1,fontFamily:"monospace",fontSize:"0.75rem",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r&&!v?t:v?"[REDACTED]":"••••••••••••••••••••"}),e.jsx("button",{type:"button",onClick:()=>N(s),disabled:n||v,style:{padding:"0.375rem",border:"none",background:"transparent",cursor:n||v?"not-allowed":"pointer",opacity:n||v?.5:1,color:"var(--cedros-admin-text-muted, #64748b)"},title:r?"Hide":"Show",children:r?w.Icons.eyeOff:w.Icons.eye}),e.jsx("button",{type:"button",onClick:()=>A(s),disabled:n,style:{padding:"0.375rem",border:"none",background:"transparent",cursor:n?"not-allowed":"pointer",opacity:n?.5:1,color:"var(--cedros-admin-text-muted, #64748b)"},title:"Edit",children:w.Icons.settings}),e.jsx("button",{type:"button",onClick:()=>_(s),disabled:n,style:{padding:"0.375rem",border:"none",background:"transparent",cursor:n?"not-allowed":"pointer",opacity:n?.5:1,color:"var(--cedros-admin-error, #ef4444)"},title:"Delete",children:w.Icons.trash})]})},s)})]}),S&&e.jsx("div",{style:{fontSize:"0.75rem",color:"var(--cedros-admin-text-muted, #64748b)",marginTop:"0.5rem"},children:S})]})}function H(b,i,a){const n=F(b,i),S=i.replace(/_/g," ").replace(/\b\w/g,h=>h.toUpperCase()),c=O[b]?.fields?.[i],l={isSecret:n,label:S,description:c?.description,hidden:c?.hidden,showWhen:c?.showWhen};return c?.type==="dropdown"&&c.options?{...l,type:"dropdown",options:c.options}:c?.type==="token_mint"?{...l,type:"token_mint"}:c?.type==="toggle"?{...l,type:"toggle"}:c?.type==="secret_array"?{...l,type:"secret_array",isSecret:!0}:c?.type==="solana_address"?{...l,type:"solana_address"}:c?.type==="number"?{...l,type:"number",unit:c.unit}:typeof a=="boolean"?{...l,type:"boolean"}:typeof a=="number"?{...l,type:"number",unit:c?.unit}:Array.isArray(a)?{...l,type:"array"}:typeof a=="object"&&a!==null?{...l,type:"object"}:{...l,type:"string"}}function Q({category:b,config:i,originalConfig:a,isLoading:n=!1,onSave:S}){const[d,c]=m.useState(i),[l,h]=m.useState(new Set);m.useEffect(()=>{c(i)},[i]);const u=m.useMemo(()=>{const t={...d};for(const s of Object.keys(t))if(F(b,s)){const r=a[s],g=t[s];(g===D||g===r)&&(t[s]=D)}return t},[d,a,b]),y=m.useMemo(()=>{const t=d.token_mint;return typeof t!="string"||!t?!1:!W(t).valid},[d]),{status:x,error:N}=J.useAutosave({data:u,onSave:S,debounceMs:1500,enabled:!y}),f=m.useCallback((t,s)=>{c(r=>({...r,[t]:s}))},[]),E=m.useCallback(t=>{h(s=>{const r=new Set(s);return r.has(t)?r.delete(t):r.add(t),r})},[]),_=t=>t?e.jsx("div",{style:{fontSize:"0.75rem",color:"var(--cedros-admin-text-muted, #64748b)",marginTop:"0.25rem"},children:t}):null,A=(t,s)=>{const r=H(b,t,a[t]??s);if(r.type==="dropdown"&&r.options)return e.jsx(w.FormDropdown,{value:s,onChange:o=>f(t,o),options:r.options.map(o=>({value:o,label:o})),label:r.label,description:r.description,disabled:n});if(r.type==="token_mint")return e.jsx(X,{label:r.label,value:s,onChange:o=>f(t,o),decimals:d.token_decimals??6,onDecimalsChange:o=>f("token_decimals",o),disabled:n,description:r.description,customSymbol:d.custom_token_symbol||"",customIcon:d.custom_token_icon||"",onCustomSymbolChange:o=>f("custom_token_symbol",o),onCustomIconChange:o=>f("custom_token_icon",o)});if(r.type==="toggle")return e.jsxs("div",{className:"cedros-admin__field",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx("button",{type:"button",role:"switch","aria-checked":s,onClick:()=>f(t,!s),disabled:n,style:{width:44,height:24,borderRadius:12,border:"none",backgroundColor:s?"var(--cedros-admin-primary, #171717)":"var(--cedros-admin-border, #d4d4d4)",cursor:n?"not-allowed":"pointer",position:"relative",transition:"background-color 0.2s",opacity:n?.5:1,flexShrink:0},children:e.jsx("span",{style:{position:"absolute",top:2,left:s?22:2,width:20,height:20,borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}})}),e.jsx("span",{className:"cedros-admin__field-label",style:{marginBottom:0},children:r.label})]}),_(r.description)]});if(r.type==="solana_address"){const o=s||"",C=W(o);return e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:r.label}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx("input",{type:"text",className:`cedros-admin__input ${C.valid?"":"cedros-admin__input--error"}`,value:o,onChange:R=>f(t,R.target.value),disabled:n,placeholder:"e.g. 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",style:{width:"100%",fontFamily:"monospace",fontSize:"0.875rem",borderColor:C.valid?void 0:"var(--cedros-admin-error, #dc2626)",paddingRight:o&&C.valid?"2rem":void 0}}),o&&C.valid&&e.jsx("span",{style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",color:"var(--cedros-admin-success, #16a34a)",fontSize:"1rem"},title:"Valid Solana address",children:"✓"})]}),!C.valid&&e.jsx("span",{style:{color:"var(--cedros-admin-error, #dc2626)",fontSize:"0.75rem",marginTop:"0.25rem",display:"block"},children:C.error}),_(r.description)]})}if(r.type==="boolean")return e.jsxs("div",{className:"cedros-admin__field",children:[e.jsxs("label",{className:"cedros-admin__checkbox",children:[e.jsx("input",{type:"checkbox",checked:s,onChange:o=>f(t,o.target.checked),disabled:n}),r.label]}),_(r.description)]});if(r.type==="number")return e.jsxs("div",{className:"cedros-admin__field",children:[e.jsxs("label",{className:"cedros-admin__field-label",children:[r.label,r.unit&&e.jsxs("span",{className:"cedros-admin__field-unit",children:[" (",r.unit,")"]})]}),e.jsx("input",{type:"number",className:"cedros-admin__input",value:s,onChange:o=>f(t,parseFloat(o.target.value)||0),disabled:n}),_(r.description)]});if(r.type==="secret_array")return e.jsx(Z,{label:r.label,value:s,onChange:o=>f(t,o),disabled:n,description:r.description});if(r.type==="array"){const o=s;return e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:r.label}),e.jsx("textarea",{className:"cedros-admin__textarea",value:o.join(`
2
+ `),onChange:C=>f(t,C.target.value.split(`
3
+ `).filter(Boolean)),placeholder:"One item per line",rows:3,disabled:n}),_(r.description)]})}if(r.type==="object")return e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:r.label}),e.jsx("textarea",{className:"cedros-admin__textarea cedros-admin__textarea--mono",value:JSON.stringify(s,null,2),onChange:o=>{try{f(t,JSON.parse(o.target.value))}catch{}},rows:5,disabled:n}),_(r.description)]});const g=l.has(t),v=r.isSecret&&!g&&s===D?D:s;return e.jsxs("div",{className:"cedros-admin__field",children:[e.jsxs("label",{className:"cedros-admin__field-label",children:[r.label,r.isSecret&&e.jsx("span",{className:"cedros-admin__field-secret",children:" (secret)"})]}),e.jsxs("div",{className:"cedros-admin__input-group",children:[e.jsx("input",{type:r.isSecret&&!g?"password":"text",className:"cedros-admin__input",value:v,onChange:o=>f(t,o.target.value),disabled:n,placeholder:r.isSecret?"••••••••":""}),r.isSecret&&e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost",onClick:()=>E(t),style:{padding:"0.5rem",minWidth:"auto"},title:g?"Hide":"Show",children:g?w.Icons.eyeOff:w.Icons.eye})]}),_(r.description)]})},j=Object.keys(d),k=t=>{const s=H(b,t,a[t]??d[t]);if(s.hidden||s.showWhen&&!d[s.showWhen])return!1;if(t==="token_decimals"){const r=d.token_mint;if(r&&P.STABLECOIN_METADATA[r])return!1}return!0};return e.jsxs("div",{className:"cedros-admin__config-editor",children:[e.jsx("div",{className:"cedros-admin__config-fields",children:j.filter(k).map(t=>e.jsx("div",{className:"cedros-admin__config-field",children:A(t,d[t])},t))}),e.jsx("div",{className:"cedros-admin__config-actions",children:e.jsx("div",{className:"cedros-admin__autosave-status",children:e.jsx($.AutosaveIndicator,{status:x,error:N})})})]})}function ee({serverUrl:b,apiKey:i,authManager:a,category:n,title:S,description:d,enabledField:c="enabled",showEnabledToggle:l=!1}){const h=m.useMemo(()=>new Y(b,void 0,a),[b,a]),[u,y]=m.useState(null),[x,N]=m.useState([]),[f,E]=m.useState(!1),[_,A]=m.useState(!0),[j,k]=m.useState(null),[t,s]=m.useState(null),[r,g]=m.useState(!1),v=O[n]||{label:n,icon:"⚙️"},o=S||v.label,C=d||v.description,R=m.useCallback(async()=>{A(!0),k(null);try{const p=await h.getConfig(n,!0);y(p)}catch{y(null),k("Failed to load settings")}finally{A(!1)}},[h,n]);m.useEffect(()=>{R()},[R]);const z=m.useCallback(async()=>{try{const p=await h.getHistory(n,20);N(p.history)}catch{N([])}},[h,n]);m.useEffect(()=>{f&&z()},[f,z]);const q=m.useCallback(async p=>{await h.updateConfig(n,p,"Updated via admin dashboard")},[h,n]),U=m.useCallback(async p=>h.validateConfig(n,p),[h,n]),[M,B]=m.useState(!1),K=m.useCallback(async()=>{if(!u||M)return;const p=!!u.config[c],I=!p,V={...u.config,[c]:I};B(!0),y({...u,config:V});try{await h.updateConfig(n,V,`${I?"Enabled":"Disabled"} via admin dashboard`)}catch(L){y({...u,config:{...u.config,[c]:p}}),k(L instanceof Error?L.message:"Failed to save enabled state")}finally{B(!1)}},[u,h,n,c,M]),T=!!u?.config[c];return _&&!u?e.jsx("div",{className:"cedros-admin__section",children:e.jsxs("div",{className:"cedros-admin__loading",children:[w.Icons.loading," Loading ",o," settings..."]})}):e.jsxs("div",{className:"cedros-admin__section",children:[e.jsx(w.ErrorBanner,{message:j,onRetry:R}),e.jsxs("div",{className:"cedros-admin__section-header",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"cedros-admin__section-title",children:[e.jsx("span",{style:{marginRight:"0.5rem"},children:v.icon}),o]}),C&&e.jsx("p",{className:"cedros-admin__text-muted",style:{marginTop:"0.25rem"},children:C})]}),l&&u&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx("span",{style:{fontSize:"0.875rem",color:T?"var(--cedros-admin-text, #171717)":"var(--cedros-admin-muted, #737373)"},children:T?"Enabled":"Disabled"}),e.jsx("button",{type:"button",role:"switch","aria-checked":T,onClick:K,disabled:M,style:{width:44,height:24,borderRadius:12,border:"none",backgroundColor:T?"var(--cedros-admin-primary, #171717)":"var(--cedros-admin-border, #d4d4d4)",cursor:M?"wait":"pointer",position:"relative",transition:"background-color 0.2s",flexShrink:0,opacity:M?.6:1},children:e.jsx("span",{style:{position:"absolute",top:2,left:T?22:2,width:20,height:20,borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}})})]})]}),u&&e.jsxs("div",{className:"cedros-admin__settings-editor",style:{marginTop:"1rem",opacity:l&&!T?.6:1,pointerEvents:l&&!T?"none":"auto"},children:[l&&!T&&e.jsx("div",{style:{padding:"0.75rem 1rem",marginBottom:"1rem",backgroundColor:"var(--cedros-admin-warning-bg, #fef3c7)",border:"1px solid var(--cedros-admin-warning-border, #f59e0b)",borderRadius:"0.375rem",fontSize:"0.875rem",color:"var(--cedros-admin-warning-text, #92400e)",pointerEvents:"auto"},children:"This payment method is disabled. Enable it using the toggle above to accept payments."}),e.jsx(Q,{category:u.category,config:u.config,originalConfig:u.config,onSave:q,onValidate:U})]}),f&&e.jsxs("div",{className:"cedros-admin__settings-history",style:{marginTop:"1.5rem"},children:[e.jsx("h4",{style:{marginBottom:"0.75rem",fontWeight:600},children:"Change History"}),x.length===0?e.jsx("p",{className:"cedros-admin__text-muted",children:"No history entries found."}):e.jsx("div",{className:"cedros-admin__settings-timeline",children:x.map(p=>e.jsxs("div",{className:"cedros-admin__settings-timeline-item",children:[e.jsx("div",{className:"cedros-admin__settings-timeline-dot"}),e.jsxs("div",{className:"cedros-admin__settings-timeline-content",children:[e.jsxs("div",{className:"cedros-admin__settings-timeline-header",children:[e.jsx("code",{children:p.configKey}),e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${p.action.toLowerCase()}`,children:p.action})]}),e.jsxs("div",{className:"cedros-admin__settings-timeline-meta",children:[w.formatDateTime(p.changedAt)," by ",p.changedBy]})]})]},p.id))})]}),t&&e.jsx("div",{style:{marginTop:"1rem",padding:"0.75rem 1rem",borderRadius:"0.375rem",backgroundColor:t.valid?"var(--cedros-admin-success-bg, #dcfce7)":"var(--cedros-admin-error-bg, #fef2f2)",border:`1px solid ${t.valid?"var(--cedros-admin-success-border, #86efac)":"var(--cedros-admin-error-border, #fecaca)"}`},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:600,color:t.valid?"var(--cedros-admin-success, #16a34a)":"var(--cedros-admin-error, #dc2626)",marginBottom:t.errors.length>0||t.warnings.length>0?"0.5rem":0},children:t.valid?"✓ Configuration is valid":"✗ Validation failed"}),t.errors.length>0&&e.jsx("ul",{style:{margin:0,paddingLeft:"1.25rem",color:"var(--cedros-admin-error, #dc2626)",fontSize:"0.875rem"},children:t.errors.map((p,I)=>e.jsx("li",{children:p},I))}),t.warnings.length>0&&e.jsx("ul",{style:{margin:t.errors.length>0?"0.5rem 0 0":0,paddingLeft:"1.25rem",color:"var(--cedros-admin-warning, #ca8a04)",fontSize:"0.875rem"},children:t.warnings.map((p,I)=>e.jsx("li",{children:p},I))})]}),e.jsx("button",{type:"button",onClick:()=>s(null),style:{background:"none",border:"none",cursor:"pointer",padding:"0.25rem",color:"var(--cedros-admin-text-muted, #64748b)",fontSize:"1.25rem",lineHeight:1},title:"Dismiss",children:"×"})]})}),e.jsxs("div",{style:{marginTop:"1.5rem",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>E(!f),children:f?"Hide History":"History"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",disabled:r||!u,onClick:async()=>{if(u){g(!0),s(null);try{const p=await U(u.config);s(p)}catch(p){s({valid:!1,errors:[p instanceof Error?p.message:"Validation failed"],warnings:[]})}finally{g(!1)}}},children:r?"Validating...":"Validate"})]})]})}exports.SingleCategorySettings=ee;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),g=require("./index-B-0trqeD.js"),o=require("./Toggle-CsPSF8Dr.js"),O=require("./useAutosave-B2p6iwh8.js"),M=require("./AutosaveIndicator-DxemlKnX.js"),b={enabled:!0,relatedProducts:{mode:"most_recent",maxItems:4,layout:{layout:"large",imageCrop:"center"}},catalog:{filters:{tags:!0,priceRange:!0,inStock:!0},sort:{featured:!0,priceAsc:!0,priceDesc:!0}},checkout:{promoCodes:!0},shopLayout:{layout:"large",imageCrop:"center"},categoryLayout:{layout:"large",imageCrop:"center"},sections:{showDescription:!0,showSpecs:!0,showShipping:!0,showRelatedProducts:!0},inventory:{preCheckoutVerification:!0,holdsEnabled:!1,holdDurationMinutes:15},shopPage:{title:"Shop",description:""}},$=[{value:"most_recent",label:"Most Recent",description:"Show the most recently added products (excluding current product)."},{value:"by_category",label:"By Category",description:"Show products from the same category as the current product."},{value:"manual",label:"Manual Selection",description:"Specify related products per-product using relatedProductIds in metadata."},{value:"ai",label:"AI Recommendations",description:"Let AI analyze products and suggest the best matches. Requires AI to be configured in AI Settings."}],S=[{value:"large",label:"Large",description:"Portrait cards (4:5) with full product info, description, and tags."},{value:"square",label:"Square",description:"Square cards (1:1) showing title and price only."},{value:"compact",label:"Compact",description:"Compact cards (3:4) with smaller text to fit more products."}],C=[{value:"center",label:"Center"},{value:"top",label:"Top"},{value:"bottom",label:"Bottom"},{value:"left",label:"Left"},{value:"right",label:"Right"}],q=[{id:"shop-page",label:"Shop Page"},{id:"catalog",label:"Catalog"},{id:"layouts",label:"Layouts"},{id:"product-pages",label:"Product Pages"},{id:"checkout",label:"Checkout"}];function H({serverUrl:h,apiKey:d,authManager:c}){const[m,P]=l.useState("shop-page"),[a,i]=l.useState(b),[I,z]=l.useState(!0),[W,B]=l.useState(!0),[L,y]=l.useState(null),x=l.useCallback(async()=>{try{y(null);let t;const s="/admin/config/shop";if(c?.isAuthenticated())t=await c.fetchWithAuth(s);else{const r={"Content-Type":"application/json"};d&&(r["X-API-Key"]=d);const n=await fetch(`${h}${s}`,{headers:r});if(!n.ok)throw new Error(`Failed to fetch settings: ${n.status}`);t=await n.json()}i({...b,...t.config})}catch{i(b),y("Could not load saved settings. Showing defaults.")}finally{z(!1),setTimeout(()=>B(!1),100)}},[h,d,c]);l.useEffect(()=>{x()},[x]);const D=l.useCallback(async t=>{const s="/admin/config/shop",r=JSON.stringify({config:t});try{if(c?.isAuthenticated())await c.fetchWithAuth(s,{method:"PUT",body:r});else{const n={"Content-Type":"application/json"};d&&(n["X-API-Key"]=d);const p=await fetch(`${h}${s}`,{method:"PUT",headers:n,body:r});if(!p.ok)throw new Error(`Failed to save settings: ${p.status}`)}}catch{throw y("Failed to save storefront settings"),new Error("Save failed")}},[h,d,c]),{status:N,error:R}=O.useAutosave({data:a,onSave:D,debounceMs:1500,enabled:!W}),A=t=>{i(s=>({...s,relatedProducts:{...s.relatedProducts,mode:t}}))},E=t=>{i(s=>({...s,relatedProducts:{...s.relatedProducts,maxItems:t}}))},_=(t,s)=>{i(r=>({...r,relatedProducts:{...r.relatedProducts,layout:{...r.relatedProducts.layout,[t]:s}}}))},f=(t,s)=>{i(r=>({...r,catalog:{...r.catalog,filters:{...r.catalog.filters,[t]:s}}}))},v=(t,s)=>{const r=a.catalog.sort,n=Object.values(r).filter(Boolean).length;!s&&n<=1||i(p=>({...p,catalog:{...p.catalog,sort:{...p.catalog.sort,[t]:s}}}))},F=(t,s)=>{i(r=>({...r,checkout:{...r.checkout,[t]:s}}))},k=(t,s)=>{i(r=>({...r,shopLayout:{...r.shopLayout,[t]:s}}))},T=(t,s)=>{i(r=>({...r,categoryLayout:{...r.categoryLayout,[t]:s}}))},u=(t,s)=>{i(r=>({...r,sections:{...r.sections,[t]:s}}))},j=(t,s)=>{i(r=>({...r,inventory:{...r.inventory,[t]:s}}))},w=(t,s)=>{i(r=>({...r,shopPage:{...r.shopPage,[t]:s}}))};return I?e.jsx("div",{className:"cedros-admin__section",children:e.jsxs("div",{className:"cedros-admin__loading",children:[g.Icons.loading," Loading storefront settings..."]})}):e.jsxs("div",{className:"cedros-admin__storefront-settings",children:[e.jsxs("div",{className:"cedros-admin__page-header",style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[e.jsxs("div",{children:[e.jsx("h2",{className:"cedros-admin__page-title",children:"Storefront"}),e.jsx("p",{className:"cedros-admin__page-description",children:"Configure catalog filters, product layouts, and checkout settings."})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",flexShrink:0},children:[e.jsx("span",{style:{fontSize:"0.875rem",color:a.enabled?"var(--cedros-admin-text, #171717)":"var(--cedros-admin-muted, #737373)"},children:a.enabled?"Enabled":"Disabled"}),e.jsx(o.Toggle,{checked:a.enabled,onChange:t=>i(s=>({...s,enabled:t}))})]})]}),!a.enabled&&e.jsx("div",{style:{padding:"0.75rem 1rem",marginBottom:"1rem",backgroundColor:"var(--cedros-admin-warning-bg, #fef3c7)",border:"1px solid var(--cedros-admin-warning-border, #f59e0b)",borderRadius:"0.375rem",fontSize:"0.875rem",color:"var(--cedros-admin-warning-text, #92400e)"},children:"The storefront is disabled. Enable it using the toggle above to activate your store."}),e.jsxs("div",{className:"cedros-admin__tabs cedros-admin__tabs--line",style:{opacity:a.enabled?1:.5,pointerEvents:a.enabled?"auto":"none"},children:[q.map(t=>e.jsx("button",{type:"button",className:`cedros-admin__tab ${m===t.id?"cedros-admin__tab--active":""}`,onClick:()=>P(t.id),children:t.label},t.id)),e.jsx("div",{style:{flex:1}}),e.jsx(M.AutosaveIndicator,{status:N,error:R})]}),e.jsx(g.ErrorBanner,{message:L,onRetry:x}),m==="shop-page"&&e.jsxs("div",{className:"cedros-admin__section",style:{marginTop:"1rem"},children:[e.jsx("h4",{style:{marginBottom:"0.5rem",fontWeight:600},children:"Shop Page Content"}),e.jsx("p",{style:{marginBottom:"1.5rem",fontSize:14,opacity:.7},children:"Customize the title and description shown on your shop page."}),e.jsxs("div",{className:"cedros-admin__field",style:{marginBottom:"1.5rem"},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Page Title"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:a.shopPage.title,onChange:t=>w("title",t.target.value),placeholder:"Shop"}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:12,opacity:.6},children:"The main heading displayed on your shop page."})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Page Description"}),e.jsx("textarea",{className:"cedros-admin__textarea",value:a.shopPage.description,onChange:t=>w("description",t.target.value),placeholder:"Browse our collection of products...",rows:3,style:{resize:"vertical"}}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:12,opacity:.6},children:"A short description or subtitle shown below the title. Leave empty to hide."})]})]}),m==="catalog"&&e.jsxs("div",{className:"cedros-admin__section",style:{marginTop:"1rem"},children:[e.jsxs("div",{children:[e.jsx("h4",{style:{marginBottom:"0.5rem",fontWeight:600},children:"Catalog Filters"}),e.jsx("p",{style:{marginBottom:"1rem",fontSize:14,opacity:.7},children:"Choose which filters appear in the shop and category page sidebars."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx(o.Toggle,{checked:a.catalog.filters.tags,onChange:t=>f("tags",t)}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:"Tags"}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:13,opacity:.6},children:"Filter products by tags (multi-select checkboxes)"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx(o.Toggle,{checked:a.catalog.filters.priceRange,onChange:t=>f("priceRange",t)}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:"Price Range"}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:13,opacity:.6},children:"Filter by minimum and maximum price"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx(o.Toggle,{checked:a.catalog.filters.inStock,onChange:t=>f("inStock",t)}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:"In Stock"}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:13,opacity:.6},children:"Show only products that are in stock"})]})]})]})]}),e.jsxs("div",{style:{marginTop:"2rem",paddingTop:"1.5rem",borderTop:"1px solid var(--cedros-admin-border, #e5e5e5)"},children:[e.jsx("h4",{style:{marginBottom:"0.5rem",fontWeight:600},children:"Sort Options"}),e.jsx("p",{style:{marginBottom:"1rem",fontSize:14,opacity:.7},children:"Choose which sort options appear in the shop and category pages. At least one must be enabled."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx(o.Toggle,{checked:a.catalog.sort.featured,onChange:t=>v("featured",t)}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:"Featured"}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:13,opacity:.6},children:"Default sort order (as returned by backend)"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx(o.Toggle,{checked:a.catalog.sort.priceAsc,onChange:t=>v("priceAsc",t)}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:"Price: Low to High"}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:13,opacity:.6},children:"Sort products by price ascending"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx(o.Toggle,{checked:a.catalog.sort.priceDesc,onChange:t=>v("priceDesc",t)}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:"Price: High to Low"}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:13,opacity:.6},children:"Sort products by price descending"})]})]})]})]})]}),m==="layouts"&&e.jsxs("div",{className:"cedros-admin__section",style:{marginTop:"1rem"},children:[e.jsx("h4",{style:{marginBottom:"0.5rem",fontWeight:600},children:"Product Layouts"}),e.jsx("p",{style:{marginBottom:"1.5rem",fontSize:14,opacity:.7},children:"Configure product card layouts for shop and category pages."}),e.jsxs("div",{style:{marginBottom:"2rem"},children:[e.jsx("div",{style:{fontWeight:500,marginBottom:"0.75rem"},children:"Shop Page"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",marginBottom:"1rem"},children:S.map(t=>{const s=a.shopLayout.layout===t.value;return e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",padding:"0.75rem",border:`2px solid ${s?"var(--cedros-admin-primary, #171717)":"var(--cedros-admin-border, #e5e5e5)"}`,borderRadius:6,cursor:"pointer",background:s?"var(--cedros-admin-bg-accent, #f5f5f5)":void 0,transition:"border-color 0.15s, background 0.15s"},children:[e.jsx("input",{type:"radio",name:"shopLayout",value:t.value,checked:s,onChange:()=>k("layout",t.value),style:{marginTop:2}}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:t.label}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:12,opacity:.6},children:t.description})]})]},t.value)})}),e.jsx(g.FormDropdown,{value:a.shopLayout.imageCrop,onChange:t=>k("imageCrop",t),options:C,label:"Image Crop",style:{maxWidth:180}})]}),e.jsxs("div",{style:{paddingTop:"1.5rem",borderTop:"1px solid var(--cedros-admin-border, #e5e5e5)"},children:[e.jsx("div",{style:{fontWeight:500,marginBottom:"0.75rem"},children:"Category Pages"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",marginBottom:"1rem"},children:S.map(t=>{const s=a.categoryLayout.layout===t.value;return e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",padding:"0.75rem",border:`2px solid ${s?"var(--cedros-admin-primary, #171717)":"var(--cedros-admin-border, #e5e5e5)"}`,borderRadius:6,cursor:"pointer",background:s?"var(--cedros-admin-bg-accent, #f5f5f5)":void 0,transition:"border-color 0.15s, background 0.15s"},children:[e.jsx("input",{type:"radio",name:"categoryLayout",value:t.value,checked:s,onChange:()=>T("layout",t.value),style:{marginTop:2}}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:t.label}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:12,opacity:.6},children:t.description})]})]},t.value)})}),e.jsx(g.FormDropdown,{value:a.categoryLayout.imageCrop,onChange:t=>T("imageCrop",t),options:C,label:"Image Crop",style:{maxWidth:180}})]})]}),m==="product-pages"&&e.jsxs("div",{className:"cedros-admin__section",style:{marginTop:"1rem"},children:[e.jsxs("div",{children:[e.jsx("h4",{style:{marginBottom:"0.5rem",fontWeight:600},children:"Related Products"}),e.jsx("p",{style:{marginBottom:"1rem",fontSize:14,opacity:.7},children:"Configure how related products are displayed on product detail pages."}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem",marginBottom:"1.5rem"},children:$.map(t=>{const s=a.relatedProducts.mode===t.value,r=t.badge==="Coming Soon";return e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",padding:"1rem",border:`2px solid ${s?"var(--cedros-admin-primary, #171717)":"var(--cedros-admin-border, #e5e5e5)"}`,borderRadius:8,cursor:r?"not-allowed":"pointer",opacity:r?.6:1,background:s?"var(--cedros-admin-bg-accent, #f5f5f5)":void 0,transition:"border-color 0.15s, background 0.15s"},children:[e.jsx("input",{type:"radio",name:"relatedProductsMode",value:t.value,checked:s,onChange:()=>!r&&A(t.value),disabled:r,style:{marginTop:2}}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx("span",{style:{fontWeight:600},children:t.label}),t.badge&&e.jsx("span",{style:{fontSize:11,padding:"2px 6px",borderRadius:4,background:"#6366f1",color:"#fff"},children:t.badge})]}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:13,opacity:.75},children:t.description})]})]},t.value)})}),a.relatedProducts.mode==="manual"&&e.jsxs("div",{style:{padding:"1rem",marginBottom:"1.5rem",background:"var(--cedros-admin-bg-accent, #f5f5f5)",borderRadius:8,border:"1px solid var(--cedros-admin-border, #e5e5e5)"},children:[e.jsx("strong",{style:{fontSize:14},children:"How to set related products:"}),e.jsxs("p",{style:{margin:"0.5rem 0 0",fontSize:13,opacity:.8},children:["When editing a product, add a ",e.jsx("code",{style:{background:"rgba(0,0,0,0.1)",padding:"2px 4px",borderRadius:3},children:"relatedProductIds"})," field to its metadata containing a comma-separated list of product IDs."]}),e.jsxs("p",{style:{margin:"0.5rem 0 0",fontSize:13,opacity:.6},children:["Example: ",e.jsx("code",{style:{background:"rgba(0,0,0,0.1)",padding:"2px 4px",borderRadius:3},children:"prod_123,prod_456,prod_789"})]})]}),e.jsxs("div",{className:"cedros-admin__field",style:{maxWidth:200},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Max Related Products"}),e.jsx("input",{type:"number",className:"cedros-admin__input",value:a.relatedProducts.maxItems,onChange:t=>E(Math.max(1,Math.min(12,parseInt(t.target.value)||4))),min:1,max:12}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:12,opacity:.6},children:"How many related products to show (1-12)"})]}),e.jsxs("div",{style:{marginTop:"1.5rem"},children:[e.jsx("div",{style:{fontWeight:500,marginBottom:"0.75rem"},children:"Display Layout"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",marginBottom:"1rem"},children:S.map(t=>{const s=a.relatedProducts.layout.layout===t.value;return e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",padding:"0.75rem",border:`2px solid ${s?"var(--cedros-admin-primary, #171717)":"var(--cedros-admin-border, #e5e5e5)"}`,borderRadius:6,cursor:"pointer",background:s?"var(--cedros-admin-bg-accent, #f5f5f5)":void 0,transition:"border-color 0.15s, background 0.15s"},children:[e.jsx("input",{type:"radio",name:"relatedLayout",value:t.value,checked:s,onChange:()=>_("layout",t.value),style:{marginTop:2}}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:t.label}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:12,opacity:.6},children:t.description})]})]},t.value)})}),e.jsx(g.FormDropdown,{value:a.relatedProducts.layout.imageCrop,onChange:t=>_("imageCrop",t),options:C,label:"Image Crop",style:{maxWidth:180}})]})]}),e.jsxs("div",{style:{marginTop:"2rem",paddingTop:"1.5rem",borderTop:"1px solid var(--cedros-admin-border, #e5e5e5)"},children:[e.jsx("h4",{style:{marginBottom:"0.5rem",fontWeight:600},children:"Page Sections"}),e.jsx("p",{style:{marginBottom:"1rem",fontSize:14,opacity:.7},children:"Choose which sections appear on product detail pages."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx(o.Toggle,{checked:a.sections.showDescription,onChange:t=>u("showDescription",t)}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:"Description"}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:13,opacity:.6},children:"Expandable description accordion"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx(o.Toggle,{checked:a.sections.showSpecs,onChange:t=>u("showSpecs",t)}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:"Specifications"}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:13,opacity:.6},children:"Product attributes and details"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx(o.Toggle,{checked:a.sections.showShipping,onChange:t=>u("showShipping",t)}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:"Shipping & Returns"}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:13,opacity:.6},children:"Shipping and return policy information"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx(o.Toggle,{checked:a.sections.showRelatedProducts,onChange:t=>u("showRelatedProducts",t)}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:"Related Products"}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:13,opacity:.6},children:"Product recommendations section"})]})]})]})]})]}),m==="checkout"&&e.jsxs("div",{className:"cedros-admin__section",style:{marginTop:"1rem"},children:[e.jsxs("div",{children:[e.jsx("h4",{style:{marginBottom:"0.5rem",fontWeight:600},children:"Checkout Settings"}),e.jsx("p",{style:{marginBottom:"1rem",fontSize:14,opacity:.7},children:"Configure checkout and cart page features."}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx(o.Toggle,{checked:a.checkout.promoCodes,onChange:t=>F("promoCodes",t)}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:"Promo Codes"}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:13,opacity:.6},children:"Show promo/coupon code input on cart and checkout pages"})]})]})})]}),e.jsxs("div",{style:{marginTop:"2rem",paddingTop:"1.5rem",borderTop:"1px solid var(--cedros-admin-border, #e5e5e5)"},children:[e.jsx("h4",{style:{marginBottom:"0.5rem",fontWeight:600},children:"Inventory Settings"}),e.jsx("p",{style:{marginBottom:"1rem",fontSize:14,opacity:.7},children:"Configure inventory verification and reservation behavior."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx(o.Toggle,{checked:a.inventory.preCheckoutVerification,onChange:t=>j("preCheckoutVerification",t)}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:"Pre-Checkout Verification"}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:13,opacity:.6},children:"Verify inventory availability before processing payment"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[e.jsx(o.Toggle,{checked:a.inventory.holdsEnabled,onChange:t=>j("holdsEnabled",t)}),e.jsxs("div",{children:[e.jsx("span",{style:{fontWeight:500},children:"Inventory Holds"}),e.jsx("p",{style:{margin:"0.125rem 0 0",fontSize:13,opacity:.6},children:"Reserve inventory when items are added to cart"})]})]})]}),a.inventory.holdsEnabled&&e.jsxs("div",{className:"cedros-admin__field",style:{maxWidth:200,marginTop:"1rem"},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Hold Duration (minutes)"}),e.jsx("input",{type:"number",className:"cedros-admin__input",value:a.inventory.holdDurationMinutes,onChange:t=>j("holdDurationMinutes",Math.max(5,Math.min(60,parseInt(t.target.value)||15))),min:5,max:60}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:12,opacity:.6},children:"How long to reserve inventory in carts (5-60 minutes)"})]})]})]})]})}exports.StorefrontSection=H;