@cedros/pay-react 1.1.28 → 1.1.30

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 (181) hide show
  1. package/README.md +8 -0
  2. package/dist/{AISettingsSection-BlIv3CzS.mjs → AISettingsSection-BMh3hAb5.mjs} +6 -4
  3. package/dist/{AISettingsSection-DELur7D2.js → AISettingsSection-C0zqPbd6.js} +2 -2
  4. package/dist/{AutosaveIndicator-Bed0-ekg.mjs → AutosaveIndicator-3ctAnz8Y.mjs} +1 -1
  5. package/dist/{AutosaveIndicator-Dn_qA2hK.js → AutosaveIndicator-DXRPr4P7.js} +1 -1
  6. package/dist/CedrosContext-5Gjveoba.mjs +2555 -0
  7. package/dist/CedrosContext-CCakH2SZ.js +3 -0
  8. package/dist/CedrosPayAdminDashboard-DaJ9JoGn.mjs +250 -0
  9. package/dist/CedrosPayAdminDashboard-Uvyh9p7A.js +1 -0
  10. package/dist/{ChatLogsSection-v4zwzCTC.mjs → ChatLogsSection-BtJixYAp.mjs} +19 -17
  11. package/dist/ChatLogsSection-FC3O536G.js +1 -0
  12. package/dist/{ComplianceSection-CemgfDrL.mjs → ComplianceSection-BMnb1p4w.mjs} +18 -15
  13. package/dist/ComplianceSection-BioTKm7k.js +1 -0
  14. package/dist/{CryptoButton-BV9owVe2.mjs → CryptoButton-Cl2kZbOP.mjs} +26 -24
  15. package/dist/CryptoButton-DxFCYDlJ.js +1 -0
  16. package/dist/{CustomersSection-D_j7OrfS.mjs → CustomersSection-dmwoBhcf.mjs} +21 -19
  17. package/dist/CustomersSection-z6ARxuex.js +1 -0
  18. package/dist/DisputesSection-BjHHQAi7.js +1 -0
  19. package/dist/{DisputesSection-BcAbXp3K.mjs → DisputesSection-CHyLne76.mjs} +19 -17
  20. package/dist/Dropdown-BRSZlhik.mjs +111 -0
  21. package/dist/Dropdown-j8o0OO5L.js +1 -0
  22. package/dist/ErrorBanner-CAgPnj62.js +1 -0
  23. package/dist/ErrorBanner-lZJhCmDX.mjs +22 -0
  24. package/dist/{FAQSection-Dn38OhB_.mjs → FAQSection-Di2xE9Sm.mjs} +8 -6
  25. package/dist/FAQSection-b34DMzgV.js +1 -0
  26. package/dist/{ImagesSection-Ctw9Icym.mjs → ImagesSection-D63PEjR6.mjs} +6 -4
  27. package/dist/ImagesSection-DGBA7iKY.js +1 -0
  28. package/dist/{InventorySection-DmhjUlRZ.mjs → InventorySection-Dp5Yu4TA.mjs} +25 -23
  29. package/dist/InventorySection-bVCECzX5.js +1 -0
  30. package/dist/LazyCedrosPayAdminDashboard-BqJDNrDI.mjs +9 -0
  31. package/dist/LazyCedrosPayAdminDashboard-CpfTtOBc.js +1 -0
  32. package/dist/{MessagingSection-B1FaGxkp.mjs → MessagingSection-BLCnCpEv.mjs} +5 -4
  33. package/dist/MessagingSection-DU0dYNMy.js +1 -0
  34. package/dist/{OrdersSection-Bj8bPdg8.mjs → OrdersSection-Bd56F3cj.mjs} +27 -24
  35. package/dist/OrdersSection-FOFEAgs1.js +1 -0
  36. package/dist/PaymentSettingsSection-52iw47Su.mjs +648 -0
  37. package/dist/PaymentSettingsSection-B5J56VAk.js +1 -0
  38. package/dist/ReturnsSection-BjpIVFfN.js +1 -0
  39. package/dist/{ReturnsSection-BC0L8r2e.mjs → ReturnsSection-DUVeKrCd.mjs} +11 -9
  40. package/dist/{SettingsSection-vdYFSNxB.js → SettingsSection-DKkHykaC.js} +1 -1
  41. package/dist/{SettingsSection-KYdEizq_.mjs → SettingsSection-vK9WIwXE.mjs} +1 -1
  42. package/dist/ShippingSection-B5lk7zpS.js +1 -0
  43. package/dist/{ShippingSection-BOgto6_9.mjs → ShippingSection-CZRrXrlh.mjs} +5 -3
  44. package/dist/{SingleCategorySettings-suJ8z9d8.mjs → SingleCategorySettings-C8xJ47_T.mjs} +143 -140
  45. package/dist/SingleCategorySettings-g7D-9lG1.js +3 -0
  46. package/dist/StatsBar-CWXw2ZT3.js +1 -0
  47. package/dist/StatsBar-D4cOKG2e.mjs +25 -0
  48. package/dist/StorefrontSection-BWnMB9k-.js +1 -0
  49. package/dist/{StorefrontSection-BRvIGBEJ.mjs → StorefrontSection-uXSVbEAa.mjs} +121 -119
  50. package/dist/{SubscriptionsSection-D60qrX9a.mjs → SubscriptionsSection-Ci_AZrWA.mjs} +11 -9
  51. package/dist/SubscriptionsSection-DQfXkuDv.js +1 -0
  52. package/dist/{TaxSection-C7-pv-Rl.mjs → TaxSection-BTukS_cU.mjs} +23 -21
  53. package/dist/TaxSection-cuPQISxZ.js +1 -0
  54. package/dist/ThemeContext-CFXyYx7A.js +1 -0
  55. package/dist/ThemeContext-l0bqcOGW.mjs +126 -0
  56. package/dist/Token22Section-CCfkDm8W.js +1 -0
  57. package/dist/{Token22Section-CrHLQ0EB.mjs → Token22Section-DRsPJuTq.mjs} +7 -6
  58. package/dist/{WalletManager-BIwH8Dw_.mjs → WalletManager-D-eoqUDy.mjs} +21 -19
  59. package/dist/WalletManager-DXChB9LA.js +1 -0
  60. package/dist/{WebhooksSection-COPW4Ec0.mjs → WebhooksSection-A8Y4ZGcj.mjs} +40 -38
  61. package/dist/WebhooksSection-CnEmaGH1.js +1 -0
  62. package/dist/admin.d.ts +2 -0
  63. package/dist/admin.js +1 -0
  64. package/dist/admin.mjs +7 -0
  65. package/dist/configApi-BS5UJfzm.js +1 -0
  66. package/dist/{configApi-6XhAJGKX.mjs → configApi-BUXZOMWK.mjs} +57 -3
  67. package/dist/crypto-only.js +1 -1
  68. package/dist/crypto-only.mjs +215 -202
  69. package/dist/dateHelpers-BKW_lGND.js +1 -0
  70. package/dist/dateHelpers-yvPkofYQ.mjs +6 -0
  71. package/dist/fetchWithTimeout-CG0EKbhf.js +1 -0
  72. package/dist/fetchWithTimeout-DmMOwL0Q.mjs +195 -0
  73. package/dist/icons-C3yDMnKE.mjs +235 -0
  74. package/dist/icons-Cjgd9YVo.js +1 -0
  75. package/dist/index-9QF_UfSN.mjs +18668 -0
  76. package/dist/index-Cq9ya93W.js +84 -0
  77. package/dist/index.js +1 -1
  78. package/dist/index.mjs +74 -63
  79. package/dist/safeHref-DqJPLPl5.mjs +12 -0
  80. package/dist/safeHref-DyHIpVjY.js +1 -0
  81. package/dist/sectionIds-D46-_-h-.js +1 -0
  82. package/dist/sectionIds-YktNxmRt.mjs +124 -0
  83. package/dist/sections-511_XBh4.js +1 -0
  84. package/dist/sections-CRaMa8ZB.mjs +9 -0
  85. package/dist/sections-more-Cgw2qJlA.js +1 -0
  86. package/dist/sections-more-Ixw6mM6R.mjs +3082 -0
  87. package/dist/src/admin/index.d.ts +3 -3
  88. package/dist/src/admin/index.d.ts.map +1 -1
  89. package/dist/src/admin/plugin.d.ts.map +1 -1
  90. package/dist/src/admin/types.d.ts +2 -6
  91. package/dist/src/admin/types.d.ts.map +1 -1
  92. package/dist/src/admin.d.ts +9 -0
  93. package/dist/src/admin.d.ts.map +1 -0
  94. package/dist/src/components/admin/LazyCedrosPayAdminDashboard.d.ts +4 -0
  95. package/dist/src/components/admin/LazyCedrosPayAdminDashboard.d.ts.map +1 -0
  96. package/dist/src/components/admin/PaymentReadinessChecklist.d.ts +9 -0
  97. package/dist/src/components/admin/PaymentReadinessChecklist.d.ts.map +1 -0
  98. package/dist/src/components/admin/PaymentSettingsSection.d.ts.map +1 -1
  99. package/dist/src/components/admin/PaymentSetupGuide.d.ts +6 -0
  100. package/dist/src/components/admin/PaymentSetupGuide.d.ts.map +1 -0
  101. package/dist/src/components/admin/ProductsSection.d.ts.map +1 -1
  102. package/dist/src/components/admin/configApi.d.ts +1 -1
  103. package/dist/src/components/admin/configApi.d.ts.map +1 -1
  104. package/dist/src/components/admin/icons.d.ts +3 -50
  105. package/dist/src/components/admin/icons.d.ts.map +1 -1
  106. package/dist/src/components/admin/index.d.ts +1 -1
  107. package/dist/src/components/admin/index.d.ts.map +1 -1
  108. package/dist/src/components/admin/types.d.ts +43 -0
  109. package/dist/src/components/admin/types.d.ts.map +1 -1
  110. package/dist/src/context/CedrosContext.d.ts +2 -0
  111. package/dist/src/context/CedrosContext.d.ts.map +1 -1
  112. package/dist/src/ecommerce/__tests__/featureFlags.test.d.ts +2 -0
  113. package/dist/src/ecommerce/__tests__/featureFlags.test.d.ts.map +1 -0
  114. package/dist/src/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -1
  115. package/dist/src/ecommerce/components/general/ErrorBoundary.d.ts +1 -1
  116. package/dist/src/ecommerce/components/ui/button.d.ts +1 -1
  117. package/dist/src/ecommerce/components/ui/sheet.d.ts +1 -1
  118. package/dist/src/ecommerce/config/context.d.ts +2 -0
  119. package/dist/src/ecommerce/config/context.d.ts.map +1 -1
  120. package/dist/src/ecommerce/config/types.d.ts +2 -0
  121. package/dist/src/ecommerce/config/types.d.ts.map +1 -1
  122. package/dist/src/ecommerce/index.d.ts +2 -0
  123. package/dist/src/ecommerce/index.d.ts.map +1 -1
  124. package/dist/src/featureFlags.d.ts +41 -0
  125. package/dist/src/featureFlags.d.ts.map +1 -0
  126. package/dist/src/index.d.ts +4 -2
  127. package/dist/src/index.d.ts.map +1 -1
  128. package/dist/src/managers/StripeManager.d.ts.map +1 -1
  129. package/dist/src/managers/SubscriptionManager.d.ts +1 -0
  130. package/dist/src/managers/SubscriptionManager.d.ts.map +1 -1
  131. package/dist/src/standalone-admin.d.ts +8 -0
  132. package/dist/src/standalone-admin.d.ts.map +1 -0
  133. package/dist/src/types/index.d.ts +14 -1
  134. package/dist/src/types/index.d.ts.map +1 -1
  135. package/dist/src/types/subscription.d.ts +47 -1
  136. package/dist/src/types/subscription.d.ts.map +1 -1
  137. package/dist/src/utils/validateConfig.d.ts.map +1 -1
  138. package/dist/standalone-admin.d.ts +2 -0
  139. package/dist/standalone-admin.js +1 -0
  140. package/dist/standalone-admin.mjs +4 -0
  141. package/dist/stripe-only.js +1 -1
  142. package/dist/stripe-only.mjs +35 -33
  143. package/dist/styles--fxb3lCl.js +1 -0
  144. package/dist/{styles-D4SQkuV3.mjs → styles-DGagylUj.mjs} +53 -51
  145. package/dist/testing/index.js +1 -1
  146. package/dist/testing/index.mjs +1 -1
  147. package/dist/tokenMintValidator-DAjQld0r.mjs +98 -0
  148. package/dist/tokenMintValidator-DNBhoefh.js +4 -0
  149. package/dist/{walletPool-DE-t1wSW.mjs → walletPool-9MylB2QK.mjs} +1 -1
  150. package/dist/walletPool-BjTXX6Vn.js +1 -0
  151. package/package.json +9 -3
  152. package/dist/CedrosContext-C2RjHLaQ.js +0 -6
  153. package/dist/CedrosContext-CY6zvjvJ.mjs +0 -2801
  154. package/dist/ChatLogsSection-BH5tLA4T.js +0 -1
  155. package/dist/ComplianceSection-DP2a9-S0.js +0 -1
  156. package/dist/CryptoButton-DpiCnyXE.js +0 -1
  157. package/dist/CustomersSection-CBwy_waO.js +0 -1
  158. package/dist/DisputesSection-BLjIk60n.js +0 -1
  159. package/dist/FAQSection-wNeH0i6Q.js +0 -1
  160. package/dist/ImagesSection-0ZzKlzMJ.js +0 -1
  161. package/dist/InventorySection-zV6lTmue.js +0 -1
  162. package/dist/MessagingSection-B_wdFR0j.js +0 -1
  163. package/dist/OrdersSection-Dw2FX-1d.js +0 -1
  164. package/dist/PaymentSettingsSection-BYF4D-GR.js +0 -1
  165. package/dist/PaymentSettingsSection-EnMxeWjv.mjs +0 -94
  166. package/dist/ReturnsSection-D_pJVxuG.js +0 -1
  167. package/dist/ShippingSection-1DRSTu49.js +0 -1
  168. package/dist/SingleCategorySettings-DwCnBdRf.js +0 -3
  169. package/dist/StorefrontSection-RumGkb3C.js +0 -1
  170. package/dist/SubscriptionsSection-C2aLLn7L.js +0 -1
  171. package/dist/TaxSection-Dt1DnM51.js +0 -1
  172. package/dist/Token22Section-DY3mUwTY.js +0 -1
  173. package/dist/WalletManager-B3UdQ5pQ.js +0 -1
  174. package/dist/WebhooksSection-CKeiJ7Py.js +0 -1
  175. package/dist/configApi-DkduMQg1.js +0 -1
  176. package/dist/index-C0g-JxJk.js +0 -84
  177. package/dist/index-DXnuQp5x.mjs +0 -22128
  178. package/dist/sections-C1NpK7hk.mjs +0 -9
  179. package/dist/sections-DVVSZBhW.js +0 -1
  180. package/dist/styles-BT4bhFey.js +0 -1
  181. package/dist/walletPool-IS7R3MR1.js +0 -1
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),L=require("./SingleCategorySettings-g7D-9lG1.js"),F=require("./configApi-BS5UJfzm.js"),W=require("./ErrorBanner-CAgPnj62.js"),q=require("./StatsBar-CWXw2ZT3.js"),O="https://github.com/conorholds/cedros-pay/tree/main/ui/docs/cross-channel-setup.md";function M({title:t,description:i,steps:n}){return e.jsxs("div",{style:{border:"1px solid var(--cedros-admin-border, #e5e7eb)",borderRadius:"0.75rem",padding:"1rem",background:"var(--cedros-admin-surface, #ffffff)"},children:[e.jsx("div",{style:{fontWeight:700,marginBottom:"0.35rem"},children:t}),e.jsx("div",{style:{color:"var(--cedros-admin-text-muted, #64748b)",fontSize:"0.9rem",marginBottom:"0.75rem",lineHeight:1.5},children:i}),e.jsx("ol",{style:{margin:0,paddingLeft:"1.1rem",lineHeight:1.6,fontSize:"0.9rem"},children:n.map(o=>e.jsx("li",{children:o},o))})]})}function R({children:t}){return e.jsx("code",{style:{display:"block",padding:"0.65rem 0.75rem",background:"rgba(15, 23, 42, 0.04)",borderRadius:"0.5rem",marginTop:"0.5rem",wordBreak:"break-all"},children:t})}function z({serverUrl:t}){const i=`${t.replace(/\/$/,"")}/webhook/stripe`,n=`${t.replace(/\/$/,"")}/paywall/v1/native-store/apple/notifications`,o=`${t.replace(/\/$/,"")}/paywall/v1/native-store/google/notifications`,r=[{title:"Stripe Web Checkout",description:"Use this for website payments and any mobile redirect Checkout flows. Cedros owns the checkout session creation, but Stripe still needs your API keys and webhook endpoint configured.",steps:["Add your Stripe publishable key, secret key, and webhook signing secret in Payment Options → Stripe.","Create a Stripe webhook endpoint that sends subscription and checkout events to the Cedros webhook URL shown below.","If your app uses custom deep links for Stripe redirects, add the scheme in Stripe → allowed redirect schemes."]},{title:"Apple App Store Billing",description:"Use this for digital goods and subscriptions distributed through the Apple App Store. Cedros verifies purchases and handles server notifications, but you still need to create App Store Connect products and credentials.",steps:["In Products, map each store-managed product to its Apple product ID and choose the correct store-managed kind.","In Payment Options → App Stores, enter your App Store Server API issuer ID, key ID, private key, and bundle ID.","Create the matching products and subscriptions in App Store Connect, then point App Store Server Notifications at the Cedros Apple notification URL.","If you rely on reader, US external purchase link, or similar exceptions, configure those policies in the app build and only after Apple approves the relevant entitlement."]},{title:"Google Play Billing",description:"Use this for digital goods and subscriptions distributed through Google Play. Cedros verifies purchases, acknowledges them server-side, and processes RTDNs, but you still need Play Console catalog and service-account setup.",steps:["In Products, map each Play product ID and, for subscriptions, the package name, base plan ID, and optional offer ID.","In Payment Options → App Stores, enter your Google Play service-account email, private key, package name, push service-account email, and push audience.","Create the matching one-time products or subscriptions in Google Play Console and point RTDN delivery at the Cedros Google notification URL.","If you participate in User Choice Billing, Alternative Billing Only, or External Offers programs, configure those policies explicitly in the app build only for approved storefronts."]}];return e.jsxs("div",{style:{display:"grid",gap:"1rem",marginBottom:"1rem"},children:[e.jsxs("div",{style:{padding:"1rem",borderRadius:"0.75rem",background:"var(--cedros-admin-subtle, rgba(15, 23, 42, 0.03))",border:"1px solid var(--cedros-admin-border, #e5e7eb)"},children:[e.jsx("div",{style:{fontWeight:700,marginBottom:"0.4rem"},children:"Turnkey setup path"}),e.jsx("div",{style:{color:"var(--cedros-admin-text-muted, #64748b)",lineHeight:1.6,fontSize:"0.9rem"},children:"Create the product once in Cedros, configure each payment channel here, then point Stripe, App Store Connect, and Google Play Console at the Cedros endpoints below. Cedros packages can then load the same product catalog and apply the right rail at runtime."}),e.jsx(R,{children:i}),e.jsx(R,{children:n}),e.jsx(R,{children:o}),e.jsx("div",{style:{marginTop:"0.5rem",color:"var(--cedros-admin-text-muted, #64748b)",fontSize:"0.8rem",lineHeight:1.5},children:"Store notifications must target a tenant-specific Cedros deployment URL. If your deployment injects tenant context via domain, path prefix, or headers, use that tenant-scoped URL here instead of a generic shared endpoint."}),e.jsx("a",{href:O,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-block",marginTop:"0.75rem",fontSize:"0.85rem",fontWeight:600,textDecoration:"underline",color:"inherit"},children:"Open the full cross-channel setup guide"})]}),e.jsx("div",{style:{display:"grid",gap:"1rem",gridTemplateColumns:"repeat(auto-fit, minmax(260px, 1fr))"},children:r.map(a=>e.jsx(M,{...a},a.title))})]})}function p(t){return typeof t=="string"&&t.trim().length>0}function G(t){switch(t){case"complete":return"Complete";case"manual":return"Manual check";case"incomplete":default:return"Needs setup"}}function N(t){switch(t){case"complete":return{background:"rgba(34, 197, 94, 0.12)",color:"#166534",border:"rgba(34, 197, 94, 0.24)"};case"manual":return{background:"rgba(245, 158, 11, 0.12)",color:"#92400e",border:"rgba(245, 158, 11, 0.24)"};case"incomplete":default:return{background:"rgba(239, 68, 68, 0.12)",color:"#991b1b",border:"rgba(239, 68, 68, 0.24)"}}}function U(t){const i=t.metadata?.store_policy_fulfillment_type;if(i==="digital_in_app"||i==="physical_goods"||i==="real_world_service"||i==="reader_content"||i==="other")return i;switch(t.fulfillment?.type){case"shipping":return"physical_goods";case"service":return"real_world_service";case"digital_download":return"digital_in_app";default:return}}function H(t){let i=0,n=0,o=0,r=0,a=0;return t.forEach(d=>{if(U(d)!=="digital_in_app")return;i+=1;const s=d.storeBilling,x=!!s?.apple?.productId,y=!!s?.google?.productId,b=s?.kind==="auto_renewable_subscription"&&y,k=!!s?.google?.basePlanId;x&&y&&(!b||k)&&(n+=1),x||(o+=1),y||(r+=1),b&&!k&&(a+=1)}),{digitalCount:i,fullyMappedCount:n,missingAppleCount:o,missingGoogleCount:r,missingBasePlanCount:a}}function V(t){return t.some(i=>i.status==="incomplete")?"incomplete":t.some(i=>i.status==="manual")?"manual":"complete"}async function Q(t){const{serverUrl:i,apiKey:n,authManager:o}=t;if(o?.isAuthenticated())return(await o.fetchWithAuth("/admin/products?limit=500")).products??[];const r={"Content-Type":"application/json"};n&&(r["X-API-Key"]=n);const a=await fetch(`${i.replace(/\/$/,"")}/admin/products?limit=500`,{headers:r});if(!a.ok)throw new Error(`Failed to fetch products (${a.status})`);return(await a.json()).products??[]}function X({section:t}){const i=V(t.items),n=N(i);return e.jsxs("div",{style:{border:"1px solid var(--cedros-admin-border, #e5e7eb)",borderRadius:"0.75rem",padding:"1rem",background:"var(--cedros-admin-surface, #ffffff)"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"1rem",marginBottom:"0.5rem"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:700},children:t.title}),e.jsx("div",{style:{color:"var(--cedros-admin-text-muted, #64748b)",fontSize:"0.9rem",lineHeight:1.5},children:t.description})]}),e.jsx("span",{style:{background:n.background,color:n.color,border:`1px solid ${n.border}`,borderRadius:"999px",padding:"0.2rem 0.6rem",fontSize:"0.78rem",fontWeight:600,whiteSpace:"nowrap"},children:G(i)})]}),e.jsx("div",{style:{display:"grid",gap:"0.65rem",marginTop:"0.85rem"},children:t.items.map(o=>{const r=N(o.status);return e.jsxs("div",{style:{border:"1px solid var(--cedros-admin-border, #e5e7eb)",borderRadius:"0.65rem",padding:"0.8rem",background:"rgba(15, 23, 42, 0.015)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem",marginBottom:"0.35rem"},children:[e.jsx("div",{style:{fontWeight:600},children:o.title}),e.jsx("span",{style:{background:r.background,color:r.color,border:`1px solid ${r.border}`,borderRadius:"999px",padding:"0.15rem 0.5rem",fontSize:"0.75rem",fontWeight:600,whiteSpace:"nowrap"},children:G(o.status)})]}),e.jsx("div",{style:{color:"var(--cedros-admin-text-muted, #64748b)",fontSize:"0.88rem",lineHeight:1.5},children:o.detail})]},`${t.title}-${o.title}`)})})]})}function J({serverUrl:t,apiKey:i,authManager:n}){const o=u.useMemo(()=>new F.ConfigApiClient(t,void 0,n),[t,n]),[r,a]=u.useState([]),[d,A]=u.useState({}),[s,x]=u.useState({}),[y,b]=u.useState(!0),[k,D]=u.useState(null),[B,E]=u.useState(0);u.useEffect(()=>{let l=!1;return(async()=>{b(!0),D(null);try{const[g,m,C]=await Promise.all([o.getConfig("stripe",!0),o.getConfig("native_store",!0),Q({serverUrl:t,apiKey:i,authManager:n})]);if(l)return;A(g.config??{}),x(m.config??{}),a(C)}catch(g){if(l)return;D(g instanceof Error?g.message:"Failed to load payment readiness data")}finally{l||b(!1)}})(),()=>{l=!0}},[i,n,o,B,t]);const v=u.useMemo(()=>{const l=p(d.secret_key)&&p(d.publishable_key),S=p(d.webhook_secret),g=s.apple_enabled===!0,m=g&&p(s.apple_issuer_id)&&p(s.apple_key_id)&&p(s.apple_private_key)&&p(s.apple_bundle_id),C=s.google_enabled===!0,h=C&&p(s.google_service_account_email)&&p(s.google_private_key)&&p(s.google_package_name)&&p(s.google_push_service_account_email)&&p(s.google_push_audience),{digitalCount:c,fullyMappedCount:P,missingAppleCount:j,missingGoogleCount:w,missingBasePlanCount:_}=H(r),$=[{title:"Website / Stripe",description:"Web checkout and browser-based mobile Stripe flows rely on your Stripe keys and webhook wiring.",items:[{title:"Stripe API keys",status:l?"complete":"incomplete",detail:l?"Publishable and secret keys are configured in Cedros.":"Add both the Stripe publishable key and secret key in Payment Options → Stripe."},{title:"Stripe webhook signing secret",status:S?"complete":"incomplete",detail:S?"Cedros has a webhook signing secret configured.":"Add the Stripe webhook signing secret so Cedros can trust subscription and checkout lifecycle events."},{title:"Stripe dashboard webhook endpoint",status:l&&S?"manual":"incomplete",detail:l&&S?`Confirm Stripe sends events to ${t.replace(/\/$/,"")}/webhook/stripe and that test events succeed.`:"Finish the Stripe config above, then create the webhook in Stripe Dashboard and point it at Cedros."}]},{title:"Apple App Store",description:"Apple digital goods require App Store billing plus matching App Store Connect catalog and server credentials.",items:[{title:"Apple native-store credentials",status:m?"complete":"incomplete",detail:m?"Issuer ID, key ID, private key, and bundle ID are configured.":g?"Apple billing is enabled, but Cedros is still missing one or more App Store Server API credentials.":"Enable Apple App Store billing and add the App Store Server API credentials in Payment Options → App Stores."},{title:"Apple product mapping",status:c===0?"manual":j===0?"complete":"incomplete",detail:c===0?"No digital in-app products are classified yet. Create or classify a digital product before shipping on the App Store.":j===0?`All ${c} digital in-app products have an Apple product ID.`:`${j} of ${c} digital in-app products still need an Apple product ID.`},{title:"App Store Connect server notifications",status:m?"manual":"incomplete",detail:m?`Confirm App Store Server Notifications point to ${t.replace(/\/$/,"")}/paywall/v1/native-store/apple/notifications using your tenant-scoped Cedros URL.`:"Finish the Apple credentials first, then configure App Store Server Notifications in App Store Connect."}]},{title:"Google Play",description:"Google digital goods require Play Billing plus Play Console product mapping, service-account access, and RTDN wiring.",items:[{title:"Google Play API and RTDN credentials",status:h?"complete":"incomplete",detail:h?"Service account, package name, RTDN push identity, and audience are configured.":C?"Google Play billing is enabled, but Cedros is still missing one or more API or RTDN verification fields.":"Enable Google Play billing and add the Android Publisher / RTDN credentials in Payment Options → App Stores."},{title:"Google product and base-plan mapping",status:c===0?"manual":w===0&&_===0?"complete":"incomplete",detail:c===0?"No digital in-app products are classified yet. Create or classify a digital product before shipping on Google Play.":w===0&&_===0?`All ${c} digital in-app products have a Google Play mapping${_===0?"":" and required base plans"}.`:`${w} products still need a Google product ID and ${_} subscription products still need a base plan ID.`},{title:"Play Console RTDN delivery",status:h?"manual":"incomplete",detail:h?`Confirm Real-time developer notifications are configured to reach ${t.replace(/\/$/,"")}/paywall/v1/native-store/google/notifications through your approved Pub/Sub push identity.`:"Finish the Google Play credentials first, then configure RTDN delivery in Google Play Console and Google Cloud Pub/Sub."}]},{title:"Cedros product catalog",description:"Cedros packages can only route correctly when the catalog itself is classified and mapped cleanly.",items:[{title:"Products created in Cedros",status:r.length>0?"complete":"incomplete",detail:r.length>0?`${r.length} products are present in the Cedros catalog.`:"Create at least one product in Admin → Products."},{title:"Digital product app-store mapping coverage",status:c===0?"manual":P===c?"complete":"incomplete",detail:c===0?"No digital in-app products are currently classified. If you sell only physical goods or real-world services, this is expected.":`${P} of ${c} digital in-app products currently have both Apple/Google mapping requirements satisfied.`},{title:"Manual end-to-end store test purchases",status:l||m||h?"manual":"incomplete",detail:l||m||h?"Run at least one website purchase, one App Store sandbox purchase, and one Google Play test purchase before shipping.":"Finish the payment channel setup first, then run real test purchases through every channel you plan to support."}]}];return{sections:$,stats:{products:r.length,digitalProducts:c,fullyMappedProducts:P,autoVerifiedChecks:$.flatMap(I=>I.items).filter(I=>I.status==="complete").length}}},[s,r,t,d]);return e.jsxs("div",{style:{marginBottom:"1rem"},children:[e.jsxs("div",{className:"cedros-admin__page-header",style:{marginBottom:"1rem"},children:[e.jsx("h3",{className:"cedros-admin__page-title",children:"Readiness Checklist"}),e.jsx("p",{className:"cedros-admin__page-description",children:"Cedros can verify configuration and product mapping automatically, but external console wiring and test purchases still require a human check."})]}),e.jsx(W.ErrorBanner,{message:k,onRetry:()=>{E(l=>l+1)}}),e.jsx(q.StatsBar,{stats:[{label:"Products",value:v.stats.products},{label:"Digital App Products",value:v.stats.digitalProducts},{label:"Fully Mapped",value:v.stats.fullyMappedProducts},{label:"Auto-Verified Checks",value:v.stats.autoVerifiedChecks}],isLoading:y}),e.jsx("div",{style:{display:"grid",gap:"1rem",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",marginTop:"1rem"},children:v.sections.map(l=>e.jsx(X,{section:l},l.title))})]})}function f({href:t,children:i}){return e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"},children:i})}const T=[{id:"app_stores",label:"App Stores",category:"native_store",description:e.jsx(e.Fragment,{children:"Configure Apple App Store and Google Play verification, lifecycle notifications, and server credentials. Use the setup guide below to connect App Store Connect and Google Play Console to Cedros."})},{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(f,{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(f,{href:"https://www.helius.dev",children:"Helius"})," or"," ",e.jsx(f,{href:"https://www.quicknode.com/chains/sol",children:"QuickNode"}),". Set up a payment address using"," ",e.jsx(f,{href:"https://phantom.app",children:"Phantom"})," or"," ",e.jsx(f,{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(f,{href:"https://docs.cedros.dev/credits",children:"Credits API documentation"}),"."]})}];function K({serverUrl:t,apiKey:i,authManager:n}){const[o,r]=u.useState("app_stores"),a=T.find(d=>d.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 the payment rails Cedros can use across web, iOS, Android, and crypto flows."})]}),e.jsx("div",{className:"cedros-admin__tabs cedros-admin__tabs--line",children:T.map(d=>e.jsx("button",{type:"button",className:`cedros-admin__tab ${o===d.id?"cedros-admin__tab--active":""}`,onClick:()=>r(d.id),children:d.label},d.id))}),e.jsxs("div",{style:{marginTop:"1rem"},children:[o==="app_stores"&&e.jsxs(e.Fragment,{children:[e.jsx(z,{serverUrl:t}),e.jsx(J,{serverUrl:t,apiKey:i,authManager:n})]}),e.jsx(L.SingleCategorySettings,{serverUrl:t,apiKey:i,authManager:n,category:a.category,title:`${a.label} Settings`,description:a.description,showEnabledToggle:!0},a.category)]})]})}exports.PaymentSettingsSection=K;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),A=require("./icons-Cjgd9YVo.js"),q=require("./ErrorBanner-CAgPnj62.js"),p=require("./dateHelpers-BKW_lGND.js"),w=["requested","approved","rejected","received","refunded"],I=s=>{switch(s){case"approved":return"success";case"refunded":return"success";case"rejected":return"failed";case"received":return"muted";case"requested":return"pending";default:return"muted"}};function D({returnRequest:s,onBack:h,onStatusUpdated:c,onError:u,fetchWithAuth:a}){const[r,g]=d.useState(s.status),[m,j]=d.useState(!1),l=async()=>{if(!(!r||r===s.status)){j(!0);try{const n=await a(`/admin/returns/${encodeURIComponent(s.id)}/status`,{method:"PUT",body:JSON.stringify({status:r})});c(n)}catch{u("Failed to update return status")}finally{j(!1)}}};return e.jsxs("div",{children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:h,style:{marginBottom:"1rem"},children:"← Back to returns"}),e.jsx("div",{className:"cedros-admin__section-header",children:e.jsxs("h3",{className:"cedros-admin__section-title",children:["Return ",e.jsx("code",{style:{fontSize:"0.8rem"},children:s.id.slice(0,12)}),e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${I(s.status)}`,style:{marginLeft:"0.5rem"},children:s.status})]})}),e.jsx("div",{className:"cedros-admin__table-container",style:{maxWidth:"500px",marginBottom:"1rem"},children:e.jsx("table",{className:"cedros-admin__table",children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600,width:"35%"},children:"Order ID"}),e.jsx("td",{children:e.jsx("code",{children:s.orderId})})]}),s.reason&&e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600},children:"Reason"}),e.jsx("td",{children:s.reason})]}),e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600},children:"Created"}),e.jsx("td",{children:p.formatDateTime(s.createdAt)})]}),s.statusUpdatedAt&&e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600},children:"Status Updated"}),e.jsx("td",{children:p.formatDateTime(s.statusUpdatedAt)})]}),s.updatedAt&&e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600},children:"Last Updated"}),e.jsx("td",{children:p.formatDateTime(s.updatedAt)})]})]})})}),e.jsxs("h4",{style:{fontSize:"0.85rem",fontWeight:600,margin:"0 0 0.5rem"},children:["Items (",s.items.length,")"]}),e.jsx("div",{className:"cedros-admin__table-container",style:{maxWidth:"500px",marginBottom:"1.25rem"},children:e.jsxs("table",{className:"cedros-admin__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Product ID"}),e.jsx("th",{children:"Variant ID"}),e.jsx("th",{children:"Qty"})]})}),e.jsx("tbody",{children:s.items.map((n,o)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{style:{fontSize:"0.75rem"},children:n.productId})}),e.jsx("td",{children:n.variantId?e.jsx("code",{style:{fontSize:"0.75rem"},children:n.variantId}):e.jsx("span",{style:{color:"var(--cedros-admin-text-muted, #888)"},children:"—"})}),e.jsx("td",{children:n.quantity})]},o))})]})}),Object.keys(s.metadata).length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{style:{fontSize:"0.85rem",fontWeight:600,margin:"0 0 0.5rem"},children:"Metadata"}),e.jsx("div",{className:"cedros-admin__table-container",style:{maxWidth:"500px",marginBottom:"1.25rem"},children:e.jsx("table",{className:"cedros-admin__table",children:e.jsx("tbody",{children:Object.entries(s.metadata).map(([n,o])=>e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600,width:"40%"},children:n}),e.jsx("td",{children:o})]},n))})})})]}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"flex-end",maxWidth:"400px"},children:[e.jsxs("div",{className:"cedros-admin__field",style:{flex:1},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Update Status"}),e.jsx("select",{className:"cedros-admin__input",value:r,onChange:n=>g(n.target.value),children:w.map(n=>e.jsx("option",{value:n,children:n},n))})]}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--primary",onClick:l,disabled:m||r===s.status,children:m?"Updating...":"Update"})]})]})}function T({serverUrl:s,apiKey:h,pageSize:c=20,authManager:u}){const[a,r]=d.useState([]),[g,m]=d.useState(!0),[j,l]=d.useState(null),[n,o]=d.useState(0),[_,R]=d.useState("all"),[S,y]=d.useState(null),[C,v]=d.useState(!1),f=d.useCallback(async(t,i)=>{if(u?.isAuthenticated())return u.fetchWithAuth(t,i);const x={"Content-Type":"application/json"};h&&(x["X-API-Key"]=h);const b=await fetch(`${s}${t}`,{...i,headers:{...x,...i?.headers}});if(!b.ok)throw new Error(`Request failed: ${b.status}`);return b.json()},[s,h,u]),N=d.useCallback(async()=>{m(!0),l(null);try{const t=new URLSearchParams;t.set("limit",String(c)),t.set("offset",String(n)),_!=="all"&&t.set("status",_);const i=await f(`/admin/returns?${t.toString()}`);r(i.returns??[])}catch{l("Failed to load returns"),r([])}finally{m(!1)}},[f,c,n,_]);d.useEffect(()=>{N()},[N]);const U=async t=>{v(!0),l(null);try{const i=await f(`/admin/returns/${encodeURIComponent(t)}`);y(i)}catch{l("Failed to load return details")}finally{v(!1)}},W=t=>{y(t),r(i=>i.map(x=>x.id===t.id?t:x))};return S?e.jsx(D,{returnRequest:S,onBack:()=>y(null),onStatusUpdated:W,onError:l,fetchWithAuth:f}):e.jsxs("div",{children:[e.jsx("div",{className:"cedros-admin__section-header",children:e.jsx("h3",{className:"cedros-admin__section-title",children:"Returns"})}),e.jsx(q.ErrorBanner,{message:j}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1rem",alignItems:"center"},children:[e.jsxs("select",{className:"cedros-admin__input",value:_,onChange:t=>{R(t.target.value),o(0)},style:{width:"auto",fontSize:"0.85rem"},children:[e.jsx("option",{value:"all",children:"All statuses"}),w.map(t=>e.jsx("option",{value:t,children:t.charAt(0).toUpperCase()+t.slice(1)},t))]}),e.jsxs("span",{style:{fontSize:"0.85rem",color:"var(--cedros-admin-text-muted, #888)"},children:[a.length," result",a.length!==1?"s":""]})]}),g||C?e.jsxs("div",{className:"cedros-admin__loading",children:[A.Icons.loading," Loading returns..."]}):a.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"No returns found."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"cedros-admin__table-container",children:e.jsxs("table",{className:"cedros-admin__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Order ID"}),e.jsx("th",{children:"Items"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Reason"}),e.jsx("th",{children:"Created"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:a.map(t=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{style:{fontSize:"0.75rem"},children:t.orderId})}),e.jsx("td",{children:t.items.length}),e.jsx("td",{children:e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${I(t.status)}`,children:t.status})}),e.jsx("td",{style:{maxWidth:"180px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.reason??e.jsx("span",{style:{color:"var(--cedros-admin-text-muted, #888)"},children:"—"})}),e.jsx("td",{children:p.formatDateTime(t.createdAt)}),e.jsx("td",{children:e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>U(t.id),children:"View"})})]},t.id))})]})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"0.75rem",fontSize:"0.85rem"},children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",disabled:n===0,onClick:()=>o(Math.max(0,n-c)),children:"Previous"}),e.jsxs("span",{children:["Showing ",a.length," return",a.length!==1?"s":""]}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",disabled:a.length<c,onClick:()=>o(n+c),children:"Next"})]})]})]})}exports.ReturnsSection=T;
@@ -1,6 +1,8 @@
1
1
  import { jsx as e, jsxs as n, Fragment as U } from "react/jsx-runtime";
2
2
  import { useState as l, useCallback as R, useEffect as D } from "react";
3
- import { E as O, I as $, k as b } from "./index-DXnuQp5x.mjs";
3
+ import { I as O } from "./icons-C3yDMnKE.mjs";
4
+ import { E as $ } from "./ErrorBanner-lZJhCmDX.mjs";
5
+ import { f as b } from "./dateHelpers-yvPkofYQ.mjs";
4
6
  const C = ["requested", "approved", "rejected", "received", "refunded"], W = (d) => {
5
7
  switch (d) {
6
8
  case "approved":
@@ -129,8 +131,8 @@ function q({ returnRequest: d, onBack: m, onStatusUpdated: c, onError: u, fetchW
129
131
  ] })
130
132
  ] });
131
133
  }
132
- function T({ serverUrl: d, apiKey: m, pageSize: c = 20, authManager: u }) {
133
- const [s, r] = l([]), [v, _] = l(!0), [p, o] = l(null), [a, h] = l(0), [g, A] = l("all"), [x, N] = l(null), [k, I] = l(!1), y = R(async (t, i) => {
134
+ function z({ serverUrl: d, apiKey: m, pageSize: c = 20, authManager: u }) {
135
+ const [s, r] = l([]), [v, _] = l(!0), [p, o] = l(null), [a, h] = l(0), [g, A] = l("all"), [x, N] = l(null), [j, I] = l(!1), y = R(async (t, i) => {
134
136
  if (u?.isAuthenticated())
135
137
  return u.fetchWithAuth(t, i);
136
138
  const f = { "Content-Type": "application/json" };
@@ -154,7 +156,7 @@ function T({ serverUrl: d, apiKey: m, pageSize: c = 20, authManager: u }) {
154
156
  D(() => {
155
157
  w();
156
158
  }, [w]);
157
- const j = async (t) => {
159
+ const k = async (t) => {
158
160
  I(!0), o(null);
159
161
  try {
160
162
  const i = await y(`/admin/returns/${encodeURIComponent(t)}`);
@@ -178,7 +180,7 @@ function T({ serverUrl: d, apiKey: m, pageSize: c = 20, authManager: u }) {
178
180
  }
179
181
  ) : /* @__PURE__ */ n("div", { children: [
180
182
  /* @__PURE__ */ e("div", { className: "cedros-admin__section-header", children: /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", children: "Returns" }) }),
181
- /* @__PURE__ */ e(O, { message: p }),
183
+ /* @__PURE__ */ e($, { message: p }),
182
184
  /* @__PURE__ */ n("div", { style: { display: "flex", gap: "0.5rem", marginBottom: "1rem", alignItems: "center" }, children: [
183
185
  /* @__PURE__ */ n(
184
186
  "select",
@@ -201,8 +203,8 @@ function T({ serverUrl: d, apiKey: m, pageSize: c = 20, authManager: u }) {
201
203
  s.length !== 1 ? "s" : ""
202
204
  ] })
203
205
  ] }),
204
- v || k ? /* @__PURE__ */ n("div", { className: "cedros-admin__loading", children: [
205
- $.loading,
206
+ v || j ? /* @__PURE__ */ n("div", { className: "cedros-admin__loading", children: [
207
+ O.loading,
206
208
  " Loading returns..."
207
209
  ] }) : s.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-admin__empty", children: "No returns found." }) : /* @__PURE__ */ n(U, { children: [
208
210
  /* @__PURE__ */ e("div", { className: "cedros-admin__table-container", children: /* @__PURE__ */ n("table", { className: "cedros-admin__table", children: [
@@ -225,7 +227,7 @@ function T({ serverUrl: d, apiKey: m, pageSize: c = 20, authManager: u }) {
225
227
  {
226
228
  type: "button",
227
229
  className: "cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",
228
- onClick: () => j(t.id),
230
+ onClick: () => k(t.id),
229
231
  children: "View"
230
232
  }
231
233
  ) })
@@ -263,5 +265,5 @@ function T({ serverUrl: d, apiKey: m, pageSize: c = 20, authManager: u }) {
263
265
  ] });
264
266
  }
265
267
  export {
266
- T as ReturnsSection
268
+ z as ReturnsSection
267
269
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("react"),d=require("./SingleCategorySettings-DwCnBdRf.js"),r=[{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."},{id:"storage",label:"Storage",category:"storage",description:"Configure S3-compatible storage for product images."}];function l({serverUrl:n,apiKey:o,authManager:c}){const[s,a]=g.useState("logging"),t=r.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, security, and storage settings."})]}),e.jsx("div",{className:"cedros-admin__tabs cedros-admin__tabs--line",children:r.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(d.SingleCategorySettings,{serverUrl:n,apiKey:o,authManager:c,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"),g=require("react"),d=require("./SingleCategorySettings-g7D-9lG1.js"),r=[{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."},{id:"storage",label:"Storage",category:"storage",description:"Configure S3-compatible storage for product images."}];function l({serverUrl:n,apiKey:o,authManager:c}){const[s,a]=g.useState("logging"),t=r.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, security, and storage settings."})]}),e.jsx("div",{className:"cedros-admin__tabs cedros-admin__tabs--line",children:r.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(d.SingleCategorySettings,{serverUrl:n,apiKey:o,authManager:c,category:t.category,title:`${t.label} Settings`,description:t.description},t.category)})]})}exports.SettingsSection=l;
@@ -1,6 +1,6 @@
1
1
  import { jsxs as s, jsx as i } from "react/jsx-runtime";
2
2
  import { useState as g } from "react";
3
- import { S as l } from "./SingleCategorySettings-suJ8z9d8.mjs";
3
+ import { S as l } from "./SingleCategorySettings-C8xJ47_T.mjs";
4
4
  const o = [
5
5
  {
6
6
  id: "logging",
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),z=require("./icons-Cjgd9YVo.js"),v=require("./ErrorBanner-CAgPnj62.js"),q=require("./dateHelpers-BKW_lGND.js"),W={name:"",description:"",countries:"",active:!0},J={name:"",rateType:"flat",amountAtomic:"",currency:"USD",minSubtotal:"",maxSubtotal:"",active:!0},A=(x,u)=>`${u.toUpperCase()} ${(x/100).toFixed(2)}`;function te({serverUrl:x,apiKey:u,authManager:S}){const[R,E]=a.useState([]),[M,P]=a.useState(!0),[w,h]=a.useState(null),[I,r]=a.useState(null),[G,_]=a.useState(!1),[f,b]=a.useState(null),[o,c]=a.useState(W),[k,T]=a.useState(!1),[n,F]=a.useState(null),[D,U]=a.useState([]),[H,$]=a.useState(!1),[K,m]=a.useState(!1),[g,p]=a.useState(null),[i,d]=a.useState(J),[B,L]=a.useState(!1),l=a.useCallback(async(t,s)=>{if(S?.isAuthenticated())return S.fetchWithAuth(t,s);const j={"Content-Type":"application/json"};u&&(j["X-API-Key"]=u);const C=await fetch(`${x}${t}`,{...s,headers:{...j,...s?.headers}});if(!C.ok)throw new Error(`Request failed: ${C.status}`);return C.json()},[x,u,S]),y=a.useCallback(async()=>{P(!0),h(null);try{const t=await l("/admin/shipping/profiles?limit=50&offset=0");E(t.profiles??[])}catch{h("Failed to load shipping profiles"),E([])}finally{P(!1)}},[l]);a.useEffect(()=>{y()},[y]);const X=t=>{b(t),c({name:t.name,description:t.description??"",countries:t.countries.join(", "),active:t.active}),_(!0)},Q=async t=>{t.preventDefault(),T(!0),r(null);try{const s={name:o.name,description:o.description||void 0,countries:o.countries.split(",").map(j=>j.trim()).filter(Boolean),active:o.active};f?await l(`/admin/shipping/profiles/${encodeURIComponent(f.id)}`,{method:"PUT",body:JSON.stringify(s)}):await l("/admin/shipping/profiles",{method:"POST",body:JSON.stringify(s)}),_(!1),b(null),y()}catch(s){r(s instanceof Error?s.message:"Failed to save profile")}finally{T(!1)}},V=async t=>{if(window.confirm("Delete this shipping profile?")){r(null);try{await l(`/admin/shipping/profiles/${encodeURIComponent(t)}`,{method:"DELETE"}),y()}catch{r("Failed to delete profile")}}},N=a.useCallback(async t=>{$(!0),h(null);try{const s=await l(`/admin/shipping/profiles/${encodeURIComponent(t.id)}/rates?limit=50&offset=0`);U(s.rates??[])}catch{h("Failed to load rates"),U([])}finally{$(!1)}},[l]),O=t=>{F(t),m(!1),p(null),N(t)},Y=t=>{p(t),d({name:t.name,rateType:t.rateType,amountAtomic:String(t.amountAtomic),currency:t.currency,minSubtotal:t.minSubtotal!=null?String(t.minSubtotal):"",maxSubtotal:t.maxSubtotal!=null?String(t.maxSubtotal):"",active:t.active}),m(!0)},Z=async t=>{if(t.preventDefault(),!!n){L(!0),r(null);try{const s={name:i.name,rateType:i.rateType,amountAtomic:parseInt(i.amountAtomic,10),currency:i.currency,active:i.active,profileId:n.id,minSubtotal:i.minSubtotal?parseInt(i.minSubtotal,10):void 0,maxSubtotal:i.maxSubtotal?parseInt(i.maxSubtotal,10):void 0};g?await l(`/admin/shipping/rates/${encodeURIComponent(g.id)}`,{method:"PUT",body:JSON.stringify(s)}):await l(`/admin/shipping/profiles/${encodeURIComponent(n.id)}/rates`,{method:"POST",body:JSON.stringify(s)}),m(!1),p(null),N(n)}catch(s){r(s instanceof Error?s.message:"Failed to save rate")}finally{L(!1)}}},ee=async t=>{if(!(!window.confirm("Delete this rate?")||!n)){r(null);try{await l(`/admin/shipping/rates/${encodeURIComponent(t)}`,{method:"DELETE"}),N(n)}catch{r("Failed to delete rate")}}};return n?e.jsxs("div",{children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>{F(null),m(!1),h(null),r(null)},style:{marginBottom:"1rem"},children:"← Back to profiles"}),e.jsxs("div",{className:"cedros-admin__section-header",children:[e.jsxs("h3",{className:"cedros-admin__section-title",children:[n.name,e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${n.active?"success":"muted"}`,style:{marginLeft:"0.5rem"},children:n.active?"Active":"Inactive"})]}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--primary",onClick:()=>{p(null),d(J),m(!0)},children:"+ Add Rate"})]}),e.jsx(v.ErrorBanner,{message:w}),e.jsx(v.ErrorBanner,{message:I}),e.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--cedros-admin-text-muted, #888)",margin:"0 0 1rem"},children:[n.description&&e.jsxs(e.Fragment,{children:[n.description," · "]}),"Countries: ",n.countries.length>0?n.countries.join(", "):"All"]}),K&&e.jsxs("form",{onSubmit:Z,style:{border:"1px solid var(--cedros-admin-border, #e0e0e0)",borderRadius:"4px",padding:"1rem",marginBottom:"1.5rem",maxWidth:"520px"},children:[e.jsx("h4",{style:{margin:"0 0 0.75rem",fontSize:"0.9rem",fontWeight:600},children:g?"Edit Rate":"New Rate"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Name *"}),e.jsx("input",{type:"text",className:"cedros-admin__input",required:!0,value:i.name,onChange:t=>d(s=>({...s,name:t.target.value})),placeholder:"Standard Shipping"})]}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[e.jsxs("div",{className:"cedros-admin__field",style:{flex:1},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Rate Type *"}),e.jsxs("select",{className:"cedros-admin__input",value:i.rateType,onChange:t=>d(s=>({...s,rateType:t.target.value})),children:[e.jsx("option",{value:"flat",children:"Flat"}),e.jsx("option",{value:"price",children:"Price-based"}),e.jsx("option",{value:"weight",children:"Weight-based"})]})]}),e.jsxs("div",{className:"cedros-admin__field",style:{flex:1},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Amount (atomic) *"}),e.jsx("input",{type:"number",className:"cedros-admin__input",required:!0,min:0,value:i.amountAtomic,onChange:t=>d(s=>({...s,amountAtomic:t.target.value})),placeholder:"500"})]}),e.jsxs("div",{className:"cedros-admin__field",style:{width:"80px"},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Currency"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:i.currency,maxLength:3,onChange:t=>d(s=>({...s,currency:t.target.value.toUpperCase()})),placeholder:"USD"})]})]}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[e.jsxs("div",{className:"cedros-admin__field",style:{flex:1},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Min Subtotal"}),e.jsx("input",{type:"number",className:"cedros-admin__input",min:0,value:i.minSubtotal,onChange:t=>d(s=>({...s,minSubtotal:t.target.value})),placeholder:"0"})]}),e.jsxs("div",{className:"cedros-admin__field",style:{flex:1},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Max Subtotal"}),e.jsx("input",{type:"number",className:"cedros-admin__input",min:0,value:i.maxSubtotal,onChange:t=>d(s=>({...s,maxSubtotal:t.target.value})),placeholder:"10000"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx("input",{type:"checkbox",id:"rate-active",checked:i.active,onChange:t=>d(s=>({...s,active:t.target.checked}))}),e.jsx("label",{htmlFor:"rate-active",className:"cedros-admin__field-label",style:{margin:0},children:"Active"})]})]}),e.jsxs("div",{style:{marginTop:"0.75rem",display:"flex",gap:"0.5rem"},children:[e.jsx("button",{type:"submit",className:"cedros-admin__button cedros-admin__button--primary",disabled:B,children:B?"Saving...":g?"Update":"Create"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost",onClick:()=>{m(!1),p(null)},children:"Cancel"})]})]}),H?e.jsxs("div",{className:"cedros-admin__loading",children:[z.Icons.loading," Loading rates..."]}):D.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"No rates yet. Add one above."}):e.jsx("div",{className:"cedros-admin__table-container",children:e.jsxs("table",{className:"cedros-admin__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Name"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Amount"}),e.jsx("th",{children:"Min / Max Subtotal"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Updated"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:D.map(t=>e.jsxs("tr",{children:[e.jsx("td",{children:t.name}),e.jsx("td",{style:{fontSize:"0.85rem"},children:t.rateType}),e.jsx("td",{style:{fontSize:"0.85rem"},children:A(t.amountAtomic,t.currency)}),e.jsxs("td",{style:{fontSize:"0.8rem",color:"var(--cedros-admin-text-muted, #888)"},children:[t.minSubtotal!=null?A(t.minSubtotal,t.currency):"—"," / ",t.maxSubtotal!=null?A(t.maxSubtotal,t.currency):"—"]}),e.jsx("td",{children:e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${t.active?"success":"muted"}`,children:t.active?"Active":"Inactive"})}),e.jsx("td",{style:{fontSize:"0.8rem"},children:q.formatDateTime(t.updatedAt)}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",gap:"0.25rem"},children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>Y(t),children:"Edit"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>ee(t.id),style:{color:"var(--cedros-admin-danger, #c00)"},children:"Delete"})]})})]},t.id))})]})})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"cedros-admin__section-header",children:[e.jsx("h3",{className:"cedros-admin__section-title",children:"Shipping"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--primary",onClick:()=>{b(null),c(W),_(!0)},children:"+ Add Profile"})]}),e.jsx(v.ErrorBanner,{message:w}),e.jsx(v.ErrorBanner,{message:I}),G&&e.jsxs("form",{onSubmit:Q,style:{border:"1px solid var(--cedros-admin-border, #e0e0e0)",borderRadius:"4px",padding:"1rem",marginBottom:"1.5rem",maxWidth:"500px"},children:[e.jsx("h4",{style:{margin:"0 0 0.75rem",fontSize:"0.9rem",fontWeight:600},children:f?"Edit Profile":"New Profile"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Name *"}),e.jsx("input",{type:"text",className:"cedros-admin__input",required:!0,value:o.name,onChange:t=>c(s=>({...s,name:t.target.value})),placeholder:"Domestic Shipping"})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Description"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:o.description,onChange:t=>c(s=>({...s,description:t.target.value})),placeholder:"Optional description"})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Countries (comma-separated ISO codes)"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:o.countries,onChange:t=>c(s=>({...s,countries:t.target.value})),placeholder:"US, CA, GB"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx("input",{type:"checkbox",id:"profile-active",checked:o.active,onChange:t=>c(s=>({...s,active:t.target.checked}))}),e.jsx("label",{htmlFor:"profile-active",className:"cedros-admin__field-label",style:{margin:0},children:"Active"})]})]}),e.jsxs("div",{style:{marginTop:"0.75rem",display:"flex",gap:"0.5rem"},children:[e.jsx("button",{type:"submit",className:"cedros-admin__button cedros-admin__button--primary",disabled:k,children:k?"Saving...":f?"Update":"Create"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost",onClick:()=>{_(!1),b(null)},children:"Cancel"})]})]}),M?e.jsxs("div",{className:"cedros-admin__loading",children:[z.Icons.loading," Loading profiles..."]}):R.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"No shipping profiles found."}):e.jsx("div",{className:"cedros-admin__table-container",children:e.jsxs("table",{className:"cedros-admin__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Name"}),e.jsx("th",{children:"Countries"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Created"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:R.map(t=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("button",{type:"button",style:{background:"none",border:"none",cursor:"pointer",fontWeight:600,padding:0,color:"var(--cedros-admin-text, #333)",fontSize:"0.9rem"},onClick:()=>O(t),children:t.name})}),e.jsx("td",{style:{fontSize:"0.8rem",color:"var(--cedros-admin-text-muted, #888)",maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.countries.length>0?t.countries.join(", "):"All"}),e.jsx("td",{children:e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${t.active?"success":"muted"}`,children:t.active?"Active":"Inactive"})}),e.jsx("td",{style:{fontSize:"0.8rem"},children:q.formatDateTime(t.createdAt)}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",gap:"0.25rem"},children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>O(t),children:"Rates"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>X(t),children:"Edit"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>V(t.id),style:{color:"var(--cedros-admin-danger, #c00)"},children:"Delete"})]})})]},t.id))})]})})]})}exports.ShippingSection=te;
@@ -1,8 +1,10 @@
1
1
  import { jsxs as a, jsx as t, Fragment as ae } from "react/jsx-runtime";
2
2
  import { useState as l, useCallback as w, useEffect as ne } from "react";
3
- import { E as x, I as q, k as J } from "./index-DXnuQp5x.mjs";
3
+ import { I as q } from "./icons-C3yDMnKE.mjs";
4
+ import { E as x } from "./ErrorBanner-lZJhCmDX.mjs";
5
+ import { f as J } from "./dateHelpers-yvPkofYQ.mjs";
4
6
  const M = { name: "", description: "", countries: "", active: !0 }, G = { name: "", rateType: "flat", amountAtomic: "", currency: "USD", minSubtotal: "", maxSubtotal: "", active: !0 }, P = (f, h) => `${h.toUpperCase()} ${(f / 100).toFixed(2)}`;
5
- function re({ serverUrl: f, apiKey: h, authManager: C }) {
7
+ function ce({ serverUrl: f, apiKey: h, authManager: C }) {
6
8
  const [E, I] = l([]), [K, k] = l(!0), [F, p] = l(null), [T, r] = l(null), [X, b] = l(!1), [y, g] = l(null), [c, m] = l(M), [D, U] = l(!1), [d, $] = l(null), [L, z] = l([]), [H, O] = l(!1), [Q, u] = l(!1), [v, _] = l(null), [n, s] = l(G), [B, W] = l(!1), o = w(async (e, i) => {
7
9
  if (C?.isAuthenticated())
8
10
  return C.fetchWithAuth(e, i);
@@ -430,5 +432,5 @@ function re({ serverUrl: f, apiKey: h, authManager: C }) {
430
432
  ] });
431
433
  }
432
434
  export {
433
- re as ShippingSection
435
+ ce as ShippingSection
434
436
  };