@cedros/pay-react 1.1.30 → 1.1.31

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 (129) hide show
  1. package/README.md +53 -30
  2. package/dist/{AISettingsSection-C0zqPbd6.js → AISettingsSection-B12x5sV5.js} +2 -2
  3. package/dist/{AISettingsSection-BMh3hAb5.mjs → AISettingsSection-DXWDF4Cf.mjs} +4 -4
  4. package/dist/AutosaveIndicator-CJdkhZis.js +1 -0
  5. package/dist/{AutosaveIndicator-3ctAnz8Y.mjs → AutosaveIndicator-D966vOrP.mjs} +1 -1
  6. package/dist/CedrosContext-3Dz7_9Ct.js +3 -0
  7. package/dist/{CedrosContext-5Gjveoba.mjs → CedrosContext-DQc_k5PG.mjs} +430 -314
  8. package/dist/ChatLogsSection-CH37u0nX.js +1 -0
  9. package/dist/{ChatLogsSection-BtJixYAp.mjs → ChatLogsSection-DR7mpuQS.mjs} +2 -2
  10. package/dist/{ComplianceSection-BMnb1p4w.mjs → ComplianceSection-C61_Hf-X.mjs} +3 -3
  11. package/dist/ComplianceSection-DS4e2IBp.js +1 -0
  12. package/dist/CryptoButton-BQceZhbn.js +1 -0
  13. package/dist/{CryptoButton-Cl2kZbOP.mjs → CryptoButton-BuO_RZLj.mjs} +4 -5
  14. package/dist/CustomersSection-Bzs9Qon3.js +1 -0
  15. package/dist/{CustomersSection-dmwoBhcf.mjs → CustomersSection-CWWvusxs.mjs} +2 -2
  16. package/dist/DisputesSection-ClcYIHga.js +1 -0
  17. package/dist/{DisputesSection-CHyLne76.mjs → DisputesSection-D8rcS5Vs.mjs} +2 -2
  18. package/dist/{Dropdown-BRSZlhik.mjs → Dropdown-0y3S40Xf.mjs} +1 -1
  19. package/dist/Dropdown-BuKiVR_L.js +1 -0
  20. package/dist/{ErrorBanner-lZJhCmDX.mjs → ErrorBanner-DAjYj6Dx.mjs} +1 -1
  21. package/dist/ErrorBanner-DxrRVqwe.js +1 -0
  22. package/dist/FAQSection-0UnN2BZs.js +1 -0
  23. package/dist/{FAQSection-Di2xE9Sm.mjs → FAQSection-Dck0NM-A.mjs} +3 -3
  24. package/dist/{ImagesSection-D63PEjR6.mjs → ImagesSection-Bn9GrRRa.mjs} +2 -2
  25. package/dist/ImagesSection-CSwBHvNl.js +1 -0
  26. package/dist/{InventorySection-Dp5Yu4TA.mjs → InventorySection-Dytfmtn8.mjs} +2 -2
  27. package/dist/InventorySection-ymxaMcIg.js +1 -0
  28. package/dist/{MessagingSection-BLCnCpEv.mjs → MessagingSection-CHFbSxJL.mjs} +3 -3
  29. package/dist/MessagingSection-Dtfv0DvU.js +1 -0
  30. package/dist/OrdersSection-BuzTs9XG.js +1 -0
  31. package/dist/{OrdersSection-Bd56F3cj.mjs → OrdersSection-vYNuVF5X.mjs} +2 -2
  32. package/dist/{PaymentSettingsSection-B5J56VAk.js → PaymentSettingsSection-BOaW8lLv.js} +1 -1
  33. package/dist/{PaymentSettingsSection-52iw47Su.mjs → PaymentSettingsSection-BqdGrXen.mjs} +3 -3
  34. package/dist/{ReturnsSection-DUVeKrCd.mjs → ReturnsSection-CRzhXKtI.mjs} +2 -2
  35. package/dist/ReturnsSection-i5W_3so1.js +1 -0
  36. package/dist/{SettingsSection-vK9WIwXE.mjs → SettingsSection-6o3d8DrH.mjs} +1 -1
  37. package/dist/{SettingsSection-DKkHykaC.js → SettingsSection-CIhO51Zj.js} +1 -1
  38. package/dist/ShippingSection-BUzPW1AG.js +1 -0
  39. package/dist/{ShippingSection-CZRrXrlh.mjs → ShippingSection-CbNzGyCP.mjs} +2 -2
  40. package/dist/SingleCategorySettings-BxVUUy8R.js +3 -0
  41. package/dist/{SingleCategorySettings-C8xJ47_T.mjs → SingleCategorySettings-Qj_ptB_x.mjs} +4 -4
  42. package/dist/{StatsBar-D4cOKG2e.mjs → StatsBar-CwCBHBn-.mjs} +1 -1
  43. package/dist/StatsBar-DDUWoizP.js +1 -0
  44. package/dist/StorefrontSection-CZZj5he9.js +1 -0
  45. package/dist/{StorefrontSection-uXSVbEAa.mjs → StorefrontSection-DIYDmj59.mjs} +4 -4
  46. package/dist/SubscriptionsSection-Bof5MElz.js +1 -0
  47. package/dist/{SubscriptionsSection-Ci_AZrWA.mjs → SubscriptionsSection-lMVHdV5X.mjs} +3 -3
  48. package/dist/TaxSection-Be-9v60Z.js +1 -0
  49. package/dist/{TaxSection-BTukS_cU.mjs → TaxSection-dD7PzQvG.mjs} +2 -2
  50. package/dist/Token22Section-Di5fHsrU.js +1 -0
  51. package/dist/{Token22Section-DRsPJuTq.mjs → Token22Section-Dos0CYEk.mjs} +2 -2
  52. package/dist/{WalletManager-D-eoqUDy.mjs → WalletManager-CGR69MiR.mjs} +1 -1
  53. package/dist/{WalletManager-DXChB9LA.js → WalletManager-ZJbGQHrn.js} +1 -1
  54. package/dist/{WebhooksSection-A8Y4ZGcj.mjs → WebhooksSection-5gqXzIhq.mjs} +2 -2
  55. package/dist/WebhooksSection-CiLDyl7c.js +1 -0
  56. package/dist/admin.js +1 -1
  57. package/dist/admin.mjs +1 -1
  58. package/dist/crypto-only.js +1 -1
  59. package/dist/crypto-only.mjs +102 -105
  60. package/dist/{index-9QF_UfSN.mjs → index-CU6M10Rs.mjs} +13 -14
  61. package/dist/{index-Cq9ya93W.js → index-DVxx_62C.js} +10 -10
  62. package/dist/index.js +1 -1
  63. package/dist/index.mjs +31 -34
  64. package/dist/pay-react.css +1 -1
  65. package/dist/plugin-BIkt3boU.mjs +339 -0
  66. package/dist/plugin-Dw8_Q8rE.js +1 -0
  67. package/dist/sections-D1d83mfH.js +1 -0
  68. package/dist/{sections-more-Ixw6mM6R.mjs → sections-DcUfZQNE.mjs} +263 -270
  69. package/dist/src/admin/plugin.d.ts.map +1 -1
  70. package/dist/src/admin/sectionIds.d.ts.map +1 -1
  71. package/dist/src/admin.d.ts +0 -7
  72. package/dist/src/admin.d.ts.map +1 -1
  73. package/dist/src/components/admin/index.d.ts +0 -1
  74. package/dist/src/components/admin/index.d.ts.map +1 -1
  75. package/dist/src/index.d.ts +0 -1
  76. package/dist/src/index.d.ts.map +1 -1
  77. package/dist/stripe-only.js +1 -1
  78. package/dist/stripe-only.mjs +18 -19
  79. package/dist/styles-BwaDljnz.js +1 -0
  80. package/dist/{styles-DGagylUj.mjs → styles-fihm6qVA.mjs} +51 -52
  81. package/dist/testing/index.js +1 -1
  82. package/dist/testing/index.mjs +1 -1
  83. package/package.json +6 -8
  84. package/dist/AutosaveIndicator-DXRPr4P7.js +0 -1
  85. package/dist/CedrosContext-CCakH2SZ.js +0 -3
  86. package/dist/CedrosPayAdminDashboard-DaJ9JoGn.mjs +0 -250
  87. package/dist/CedrosPayAdminDashboard-Uvyh9p7A.js +0 -1
  88. package/dist/ChatLogsSection-FC3O536G.js +0 -1
  89. package/dist/ComplianceSection-BioTKm7k.js +0 -1
  90. package/dist/CryptoButton-DxFCYDlJ.js +0 -1
  91. package/dist/CustomersSection-z6ARxuex.js +0 -1
  92. package/dist/DisputesSection-BjHHQAi7.js +0 -1
  93. package/dist/Dropdown-j8o0OO5L.js +0 -1
  94. package/dist/ErrorBanner-CAgPnj62.js +0 -1
  95. package/dist/FAQSection-b34DMzgV.js +0 -1
  96. package/dist/ImagesSection-DGBA7iKY.js +0 -1
  97. package/dist/InventorySection-bVCECzX5.js +0 -1
  98. package/dist/LazyCedrosPayAdminDashboard-BqJDNrDI.mjs +0 -9
  99. package/dist/LazyCedrosPayAdminDashboard-CpfTtOBc.js +0 -1
  100. package/dist/MessagingSection-DU0dYNMy.js +0 -1
  101. package/dist/OrdersSection-FOFEAgs1.js +0 -1
  102. package/dist/ReturnsSection-BjpIVFfN.js +0 -1
  103. package/dist/ShippingSection-B5lk7zpS.js +0 -1
  104. package/dist/SingleCategorySettings-g7D-9lG1.js +0 -3
  105. package/dist/StatsBar-CWXw2ZT3.js +0 -1
  106. package/dist/StorefrontSection-BWnMB9k-.js +0 -1
  107. package/dist/SubscriptionsSection-DQfXkuDv.js +0 -1
  108. package/dist/TaxSection-cuPQISxZ.js +0 -1
  109. package/dist/ThemeContext-CFXyYx7A.js +0 -1
  110. package/dist/ThemeContext-l0bqcOGW.mjs +0 -126
  111. package/dist/Token22Section-CCfkDm8W.js +0 -1
  112. package/dist/WebhooksSection-CnEmaGH1.js +0 -1
  113. package/dist/icons-C3yDMnKE.mjs +0 -235
  114. package/dist/icons-Cjgd9YVo.js +0 -1
  115. package/dist/sectionIds-D46-_-h-.js +0 -1
  116. package/dist/sectionIds-YktNxmRt.mjs +0 -124
  117. package/dist/sections-511_XBh4.js +0 -1
  118. package/dist/sections-CRaMa8ZB.mjs +0 -9
  119. package/dist/sections-more-Cgw2qJlA.js +0 -1
  120. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts +0 -40
  121. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts.map +0 -1
  122. package/dist/src/components/admin/LazyCedrosPayAdminDashboard.d.ts +0 -4
  123. package/dist/src/components/admin/LazyCedrosPayAdminDashboard.d.ts.map +0 -1
  124. package/dist/src/standalone-admin.d.ts +0 -8
  125. package/dist/src/standalone-admin.d.ts.map +0 -1
  126. package/dist/standalone-admin.d.ts +0 -2
  127. package/dist/standalone-admin.js +0 -1
  128. package/dist/standalone-admin.mjs +0 -4
  129. package/dist/styles--fxb3lCl.js +0 -1
@@ -1,12 +1,11 @@
1
- import { jsx as V } from "react/jsx-runtime";
2
- import { useMemo as Q, useState as B, useRef as ye, useEffect as U, useContext as pe, createContext as ge } from "react";
1
+ import { jsx as J } from "react/jsx-runtime";
2
+ import { useContext as oe, useState as q, useRef as ce, useEffect as B, useMemo as G, createContext as le } from "react";
3
3
  import { g as R } from "./uuid-_z3jSatJ.mjs";
4
- import { g as c, f as y, b as re, s as we, c as ve } from "./fetchWithTimeout-DmMOwL0Q.mjs";
5
- import { C as be } from "./ThemeContext-l0bqcOGW.mjs";
4
+ import { g as l, f as p, b as re, s as ve, c as be } from "./fetchWithTimeout-DmMOwL0Q.mjs";
6
5
  import { a as Ce } from "./tokenMintValidator-DAjQld0r.mjs";
7
- var oe = "https://js.stripe.com/v3", Pe = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
6
+ var ue = "https://js.stripe.com/v3", Pe = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
8
7
  var Ee = function() {
9
- for (var e = document.querySelectorAll('script[src^="'.concat(oe, '"]')), t = 0; t < e.length; t++) {
8
+ for (var e = document.querySelectorAll('script[src^="'.concat(ue, '"]')), t = 0; t < e.length; t++) {
10
9
  var r = e[t];
11
10
  if (Pe.test(r.src))
12
11
  return r;
@@ -14,7 +13,7 @@ var Ee = function() {
14
13
  return null;
15
14
  }, ae = function(e) {
16
15
  var t = "", r = document.createElement("script");
17
- r.src = "".concat(oe).concat(t);
16
+ r.src = "".concat(ue).concat(t);
18
17
  var a = document.head || document.body;
19
18
  if (!a)
20
19
  throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
@@ -25,7 +24,7 @@ var Ee = function() {
25
24
  version: "4.6.0",
26
25
  startTime: t
27
26
  });
28
- }, $ = null, K = null, W = null, ke = function(e) {
27
+ }, j = null, K = null, z = null, ke = function(e) {
29
28
  return function() {
30
29
  e(new Error("Failed to load Stripe.js"));
31
30
  };
@@ -34,7 +33,7 @@ var Ee = function() {
34
33
  window.Stripe ? e(window.Stripe) : t(new Error("Stripe.js not available"));
35
34
  };
36
35
  }, Re = function(e) {
37
- return $ !== null ? $ : ($ = new Promise(function(t, r) {
36
+ return j !== null ? j : (j = new Promise(function(t, r) {
38
37
  if (typeof window > "u" || typeof document > "u") {
39
38
  t(null);
40
39
  return;
@@ -48,47 +47,47 @@ var Ee = function() {
48
47
  if (!(a && e)) {
49
48
  if (!a)
50
49
  a = ae(e);
51
- else if (a && W !== null && K !== null) {
50
+ else if (a && z !== null && K !== null) {
52
51
  var n;
53
- a.removeEventListener("load", W), a.removeEventListener("error", K), (n = a.parentNode) === null || n === void 0 || n.removeChild(a), a = ae(e);
52
+ a.removeEventListener("load", z), a.removeEventListener("error", K), (n = a.parentNode) === null || n === void 0 || n.removeChild(a), a = ae(e);
54
53
  }
55
54
  }
56
- W = Te(t, r), K = ke(r), a.addEventListener("load", W), a.addEventListener("error", K);
55
+ z = Te(t, r), K = ke(r), a.addEventListener("load", z), a.addEventListener("error", K);
57
56
  } catch (s) {
58
57
  r(s);
59
58
  return;
60
59
  }
61
- }), $.catch(function(t) {
62
- return $ = null, Promise.reject(t);
60
+ }), j.catch(function(t) {
61
+ return j = null, Promise.reject(t);
63
62
  }));
64
63
  }, _e = function(e, t, r) {
65
64
  if (e === null)
66
65
  return null;
67
66
  var a = e.apply(void 0, t);
68
67
  return Se(a, r), a;
69
- }, j, ce = !1, le = function() {
70
- return j || (j = Re(null).catch(function(e) {
71
- return j = null, Promise.reject(e);
72
- }), j);
68
+ }, $, de = !1, fe = function() {
69
+ return $ || ($ = Re(null).catch(function(e) {
70
+ return $ = null, Promise.reject(e);
71
+ }), $);
73
72
  };
74
73
  Promise.resolve().then(function() {
75
- return le();
74
+ return fe();
76
75
  }).catch(function(i) {
77
- ce || console.warn(i);
76
+ de || console.warn(i);
78
77
  });
79
- var ue = function() {
78
+ var he = function() {
80
79
  for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
81
80
  t[r] = arguments[r];
82
- ce = !0;
81
+ de = !0;
83
82
  var a = Date.now();
84
- return le().then(function(n) {
83
+ return fe().then(function(n) {
85
84
  return _e(n, t, a);
86
85
  });
87
86
  };
88
87
  function O(i, e) {
89
88
  return i instanceof Error ? i.message : typeof i == "string" ? i : e;
90
89
  }
91
- const Me = {
90
+ const xe = {
92
91
  service_unavailable: "Service temporarily unavailable. Please try again later or contact support.",
93
92
  server_insufficient_funds: "Service temporarily unavailable. Please try again later or contact support.",
94
93
  insufficient_funds_token: "Insufficient token balance in your wallet. Please add more tokens and try again.",
@@ -103,9 +102,9 @@ async function b(i, e, t = !1) {
103
102
  try {
104
103
  const n = await i.json();
105
104
  if (t && n.verificationError) {
106
- c().debug(`Payment verification failed: ${n.verificationError.code}`);
105
+ l().debug(`Payment verification failed: ${n.verificationError.code}`);
107
106
  const s = n.verificationError.code;
108
- return Me[s] || n.verificationError.message || e;
107
+ return xe[s] || n.verificationError.message || e;
109
108
  }
110
109
  return typeof n.error == "string" ? n.error : n.error && typeof n.error == "object" && "message" in n.error ? n.error.message : e;
111
110
  } catch {
@@ -129,35 +128,35 @@ function D(i) {
129
128
  let r = e, a = Date.now();
130
129
  const n = e / t;
131
130
  function s() {
132
- const h = Date.now(), p = h - a;
133
- if (p > 0) {
134
- const g = p * n;
135
- r = Math.min(e, r + g), a = h;
131
+ const d = Date.now(), y = d - a;
132
+ if (y > 0) {
133
+ const g = y * n;
134
+ r = Math.min(e, r + g), a = d;
136
135
  }
137
136
  }
138
137
  function o() {
139
138
  return s(), r >= 1 ? (r -= 1, !0) : !1;
140
139
  }
141
- function l() {
140
+ function c() {
142
141
  return s(), Math.floor(r);
143
142
  }
144
143
  function u() {
145
144
  if (s(), r >= 1)
146
145
  return 0;
147
- const p = (1 - r) / n;
148
- return Math.ceil(p);
146
+ const y = (1 - r) / n;
147
+ return Math.ceil(y);
149
148
  }
150
149
  function f() {
151
150
  r = e, a = Date.now();
152
151
  }
153
152
  return {
154
153
  tryConsume: o,
155
- getAvailableTokens: l,
154
+ getAvailableTokens: c,
156
155
  getTimeUntilRefill: u,
157
156
  reset: f
158
157
  };
159
158
  }
160
- const N = {
159
+ const F = {
161
160
  /** 10 requests per minute - recommended for payment requests */
162
161
  PAYMENT: { maxRequests: 10, windowMs: 6e4 },
163
162
  /** 30 requests per minute - for quote fetching */
@@ -167,7 +166,7 @@ const N = {
167
166
  /** 100 requests per minute - permissive for UI interactions */
168
167
  PERMISSIVE: { maxRequests: 100, windowMs: 6e4 }
169
168
  };
170
- var Ie = /* @__PURE__ */ ((i) => (i.CLOSED = "CLOSED", i.OPEN = "OPEN", i.HALF_OPEN = "HALF_OPEN", i))(Ie || {});
169
+ var Me = /* @__PURE__ */ ((i) => (i.CLOSED = "CLOSED", i.OPEN = "OPEN", i.HALF_OPEN = "HALF_OPEN", i))(Me || {});
171
170
  class v extends Error {
172
171
  constructor(e) {
173
172
  super(e), this.name = "CircuitBreakerOpenError";
@@ -175,80 +174,80 @@ class v extends Error {
175
174
  }
176
175
  function H(i) {
177
176
  const { failureThreshold: e, timeout: t, failureWindow: r = t * 2, name: a = "circuit-breaker" } = i;
178
- let n = "CLOSED", s = [], o = 0, l = 0, u = null, f = null, h = null, p = !1;
177
+ let n = "CLOSED", s = [], o = 0, c = 0, u = null, f = null, d = null, y = !1;
179
178
  function g() {
180
179
  const S = Date.now() - r;
181
180
  s = s.filter((E) => E > S);
182
181
  }
183
182
  function m() {
184
- n === "OPEN" && h !== null && Date.now() >= h && (c().debug(`[CircuitBreaker:${a}] Transitioning OPEN → HALF_OPEN (timeout expired)`), n = "HALF_OPEN", h = null);
183
+ n === "OPEN" && d !== null && Date.now() >= d && (l().debug(`[CircuitBreaker:${a}] Transitioning OPEN → HALF_OPEN (timeout expired)`), n = "HALF_OPEN", d = null);
185
184
  }
186
- function d() {
187
- f = Date.now(), o++, n === "HALF_OPEN" ? (c().debug(`[CircuitBreaker:${a}] Success in HALF_OPEN → CLOSED`), n = "CLOSED", s = []) : n === "CLOSED" && (s = []);
185
+ function h() {
186
+ f = Date.now(), o++, n === "HALF_OPEN" ? (l().debug(`[CircuitBreaker:${a}] Success in HALF_OPEN → CLOSED`), n = "CLOSED", s = []) : n === "CLOSED" && (s = []);
188
187
  }
189
188
  function w(S) {
190
189
  const E = Date.now();
191
190
  u = E, s.push(E), g();
192
191
  const L = s.length;
193
- c().warn(`[CircuitBreaker:${a}] Failure recorded (${L}/${e}):`, S.message), n === "HALF_OPEN" ? (c().warn(`[CircuitBreaker:${a}] Failed in HALF_OPEN → OPEN`), n = "OPEN", h = E + t) : n === "CLOSED" && L >= e && (c().error(`[CircuitBreaker:${a}] Failure threshold reached (${L}) → OPEN`), n = "OPEN", h = E + t);
192
+ l().warn(`[CircuitBreaker:${a}] Failure recorded (${L}/${e}):`, S.message), n === "HALF_OPEN" ? (l().warn(`[CircuitBreaker:${a}] Failed in HALF_OPEN → OPEN`), n = "OPEN", d = E + t) : n === "CLOSED" && L >= e && (l().error(`[CircuitBreaker:${a}] Failure threshold reached (${L}) → OPEN`), n = "OPEN", d = E + t);
194
193
  }
195
194
  async function T(S) {
196
195
  if (m(), n === "OPEN") {
197
- l++;
198
- const E = h ? Math.ceil((h - Date.now()) / 1e3) : 0;
196
+ c++;
197
+ const E = d ? Math.ceil((d - Date.now()) / 1e3) : 0;
199
198
  throw new v(
200
199
  `Circuit breaker is OPEN. Service is unavailable. Retry in ${E}s.`
201
200
  );
202
201
  }
203
- if (n === "HALF_OPEN" && p)
204
- throw l++, new v(
202
+ if (n === "HALF_OPEN" && y)
203
+ throw c++, new v(
205
204
  "Circuit breaker is HALF_OPEN. A probe request is already in progress."
206
205
  );
207
- n === "HALF_OPEN" && (p = !0);
206
+ n === "HALF_OPEN" && (y = !0);
208
207
  try {
209
208
  const E = await S();
210
- return d(), E;
209
+ return h(), E;
211
210
  } catch (E) {
212
211
  throw w(E instanceof Error ? E : new Error(String(E))), E;
213
212
  } finally {
214
- p && (p = !1);
213
+ y && (y = !1);
215
214
  }
216
215
  }
217
- function x() {
216
+ function I() {
218
217
  return m(), n;
219
218
  }
220
- function M() {
219
+ function x() {
221
220
  return m(), g(), {
222
221
  state: n,
223
222
  failures: s.length,
224
223
  successes: o,
225
- rejections: l,
224
+ rejections: c,
226
225
  lastFailureTime: u,
227
226
  lastSuccessTime: f
228
227
  };
229
228
  }
230
229
  function _() {
231
- c().debug(`[CircuitBreaker:${a}] Manual reset → CLOSED`), n = "CLOSED", s = [], o = 0, l = 0, u = null, f = null, h = null;
230
+ l().debug(`[CircuitBreaker:${a}] Manual reset → CLOSED`), n = "CLOSED", s = [], o = 0, c = 0, u = null, f = null, d = null;
232
231
  }
233
- function F() {
234
- c().warn(`[CircuitBreaker:${a}] Manual trip → OPEN`), n = "OPEN", h = Date.now() + t;
232
+ function N() {
233
+ l().warn(`[CircuitBreaker:${a}] Manual trip → OPEN`), n = "OPEN", d = Date.now() + t;
235
234
  }
236
235
  return {
237
236
  execute: T,
238
- getState: x,
239
- getStats: M,
237
+ getState: I,
238
+ getStats: x,
240
239
  reset: _,
241
- trip: F
240
+ trip: N
242
241
  };
243
242
  }
244
- const lt = {
243
+ const mt = {
245
244
  /** Strict: Opens quickly (3 failures), long timeout (60s) */
246
245
  STRICT: { failureThreshold: 3, timeout: 6e4 },
247
246
  /** Standard: Balanced settings (5 failures, 30s timeout) */
248
247
  STANDARD: { failureThreshold: 5, timeout: 3e4 },
249
248
  /** Lenient: Tolerates more failures (10 failures, 15s timeout) */
250
249
  LENIENT: { failureThreshold: 10, timeout: 15e3 }
251
- }, xe = {
250
+ }, Ie = {
252
251
  // ===== PAYMENT VERIFICATION ERRORS (402) =====
253
252
  invalid_payment_proof: {
254
253
  message: "Payment verification failed",
@@ -502,7 +501,7 @@ const lt = {
502
501
  }
503
502
  };
504
503
  function Oe(i) {
505
- return xe[i] || {
504
+ return Ie[i] || {
506
505
  message: "An unexpected error occurred",
507
506
  action: "Please try again or contact support if this continues.",
508
507
  technicalHint: `Unknown error code: ${i}`
@@ -664,8 +663,8 @@ const De = {
664
663
  "nonce_already_used"
665
664
  /* NONCE_ALREADY_USED */
666
665
  ]
667
- }, ne = 300 * 1e3, z = /* @__PURE__ */ new Map();
668
- function Ne(i) {
666
+ }, ne = 300 * 1e3, W = /* @__PURE__ */ new Map();
667
+ function Fe(i) {
669
668
  if (!i)
670
669
  return;
671
670
  const e = Number(i);
@@ -686,11 +685,11 @@ class k extends Error {
686
685
  return new k(
687
686
  t,
688
687
  e.status,
689
- Ne(r)
688
+ Fe(r)
690
689
  );
691
690
  }
692
691
  }
693
- function Fe(i) {
692
+ function Ne(i) {
694
693
  if (i instanceof A || i instanceof k)
695
694
  return i.httpStatus;
696
695
  }
@@ -699,7 +698,7 @@ function Ae(i) {
699
698
  return i.retryAfterMs;
700
699
  }
701
700
  function Le(i, e) {
702
- const t = Fe(i);
701
+ const t = Ne(i);
703
702
  if (t != null) {
704
703
  const a = t;
705
704
  return a === 429 || a >= 500 && a < 600;
@@ -707,11 +706,11 @@ function Le(i, e) {
707
706
  const r = i.message.toLowerCase();
708
707
  return !!(r.includes("network") || r.includes("timeout") || r.includes("fetch failed") || r.includes("econnrefused"));
709
708
  }
710
- function qe(i, e, t, r, a) {
709
+ function Be(i, e, t, r, a) {
711
710
  const n = e * Math.pow(t, i), s = Math.min(n, r);
712
711
  return Math.floor(a ? s * 0.5 + Math.random() * s * 0.5 : s);
713
712
  }
714
- function Ue(i) {
713
+ function qe(i) {
715
714
  return new Promise((e) => setTimeout(e, i));
716
715
  }
717
716
  async function P(i, e = {}) {
@@ -722,45 +721,45 @@ async function P(i, e = {}) {
722
721
  maxDelayMs: n = 3e4,
723
722
  jitter: s = !0,
724
723
  shouldRetry: o = Le,
725
- name: l = "retry",
724
+ name: c = "retry",
726
725
  inFlightKey: u
727
726
  } = e, f = async () => {
728
727
  let g = null, m = 0;
729
- for (let d = 0; d <= t; d++)
728
+ for (let h = 0; h <= t; h++)
730
729
  try {
731
730
  const w = await i();
732
- return d > 0 && c().debug(
733
- `[Retry:${l}] Succeeded on attempt ${d + 1}/${t + 1} after ${m}ms`
731
+ return h > 0 && l().debug(
732
+ `[Retry:${c}] Succeeded on attempt ${h + 1}/${t + 1} after ${m}ms`
734
733
  ), w;
735
734
  } catch (w) {
736
735
  g = w instanceof Error ? w : new Error(String(w));
737
- const T = d === t, x = o(g, d);
738
- if (T || !x)
739
- throw c().warn(
740
- `[Retry:${l}] Failed on attempt ${d + 1}/${t + 1}. ${T ? "No more retries." : "Error not retryable."}`
736
+ const T = h === t, I = o(g, h);
737
+ if (T || !I)
738
+ throw l().warn(
739
+ `[Retry:${c}] Failed on attempt ${h + 1}/${t + 1}. ${T ? "No more retries." : "Error not retryable."}`
741
740
  ), g;
742
- const _ = Ae(g) ?? qe(
743
- d,
741
+ const _ = Ae(g) ?? Be(
742
+ h,
744
743
  r,
745
744
  a,
746
745
  n,
747
746
  s
748
747
  );
749
- m += _, c().warn(
750
- `[Retry:${l}] Attempt ${d + 1}/${t + 1} failed: ${g.message}. Retrying in ${_}ms...`
751
- ), await Ue(_);
748
+ m += _, l().warn(
749
+ `[Retry:${c}] Attempt ${h + 1}/${t + 1} failed: ${g.message}. Retrying in ${_}ms...`
750
+ ), await qe(_);
752
751
  }
753
752
  throw g || new Error("Retry failed with no error");
754
753
  };
755
754
  if (!u)
756
755
  return f();
757
- const h = z.get(u);
758
- if (h)
759
- return h;
760
- const p = f().finally(() => {
761
- z.get(u) === p && z.delete(u);
756
+ const d = W.get(u);
757
+ if (d)
758
+ return d;
759
+ const y = f().finally(() => {
760
+ W.get(u) === y && W.delete(u);
762
761
  });
763
- return z.set(u, p), p;
762
+ return W.set(u, y), y;
764
763
  }
765
764
  const C = {
766
765
  /** Quick retries for transient errors (3 retries, 1s initial, 2x backoff) */
@@ -806,13 +805,13 @@ const C = {
806
805
  maxDelayMs: 1e4
807
806
  }
808
807
  };
809
- class $e {
808
+ class Ue {
810
809
  stripe = null;
811
810
  initPromise = null;
812
811
  publicKey;
813
812
  routeDiscovery;
814
813
  complianceCheckEnabled;
815
- rateLimiter = D(N.PAYMENT);
814
+ rateLimiter = D(F.PAYMENT);
816
815
  circuitBreaker = H({
817
816
  failureThreshold: 5,
818
817
  timeout: 1e4,
@@ -830,7 +829,7 @@ class $e {
830
829
  async initialize() {
831
830
  this.stripe || (this.initPromise || (this.initPromise = (async () => {
832
831
  try {
833
- if (this.stripe = await ue(this.publicKey), !this.stripe) throw new Error("Failed to initialize Stripe");
832
+ if (this.stripe = await he(this.publicKey), !this.stripe) throw new Error("Failed to initialize Stripe");
834
833
  } catch (e) {
835
834
  throw this.initPromise = null, e;
836
835
  }
@@ -847,13 +846,13 @@ class $e {
847
846
  return await this.circuitBreaker.execute(async () => await P(
848
847
  async () => {
849
848
  const a = await this.routeDiscovery.buildUrl("/paywall/v1/stripe-session");
850
- c().debug("[StripeManager] Creating session", {
849
+ l().debug("[StripeManager] Creating session", {
851
850
  resource: e.resource,
852
851
  hasCouponCode: !!e.couponCode,
853
852
  hasMetadata: !!(e.metadata && Object.keys(e.metadata).length),
854
853
  metadataKeyCount: e.metadata ? Object.keys(e.metadata).length : 0
855
854
  });
856
- const n = await y(a, {
855
+ const n = await p(a, {
857
856
  method: "POST",
858
857
  headers: {
859
858
  "Content-Type": "application/json",
@@ -874,7 +873,7 @@ class $e {
874
873
  }
875
874
  ));
876
875
  } catch (a) {
877
- throw a instanceof v ? (c().error("[StripeManager] Circuit breaker is OPEN - Stripe service unavailable"), new Error("Stripe payment service is temporarily unavailable. Please try again in a few moments.")) : a;
876
+ throw a instanceof v ? (l().error("[StripeManager] Circuit breaker is OPEN - Stripe service unavailable"), new Error("Stripe payment service is temporarily unavailable. Please try again in a few moments.")) : a;
878
877
  }
879
878
  }
880
879
  /**
@@ -899,7 +898,7 @@ class $e {
899
898
  async runComplianceCheck(e) {
900
899
  if (!this.complianceCheckEnabled) return null;
901
900
  try {
902
- const t = await this.routeDiscovery.buildUrl("/paywall/v1/compliance-check"), r = await y(t, {
901
+ const t = await this.routeDiscovery.buildUrl("/paywall/v1/compliance-check"), r = await p(t, {
903
902
  method: "POST",
904
903
  headers: { "Content-Type": "application/json" },
905
904
  body: JSON.stringify({ resources: e })
@@ -909,7 +908,7 @@ class $e {
909
908
  if (!a.cleared)
910
909
  return { success: !1, error: `Purchase blocked: ${(a.reasons ?? ["Purchase blocked by compliance check"]).join("; ")}` };
911
910
  } catch {
912
- c().warn("[StripeManager] Compliance pre-check failed, proceeding");
911
+ l().warn("[StripeManager] Compliance pre-check failed, proceeding");
913
912
  }
914
913
  return null;
915
914
  }
@@ -940,26 +939,26 @@ class $e {
940
939
  metadata: n,
941
940
  customerEmail: s,
942
941
  customerName: o,
943
- customerPhone: l,
942
+ customerPhone: c,
944
943
  shippingAddress: u,
945
944
  billingAddress: f,
946
- couponCode: h,
947
- tipAmount: p,
945
+ couponCode: d,
946
+ tipAmount: y,
948
947
  shippingMethodId: g,
949
948
  paymentMethodId: m
950
- } = e, d = t.map((S) => S.resource), w = await this.runComplianceCheck(d);
949
+ } = e, h = t.map((S) => S.resource), w = await this.runComplianceCheck(h);
951
950
  if (w) return w;
952
951
  if (!this.rateLimiter.tryConsume())
953
952
  return {
954
953
  success: !1,
955
954
  error: "Rate limit exceeded for cart checkout. Please try again later."
956
955
  };
957
- const T = R(), M = JSON.stringify({
956
+ const T = R(), x = JSON.stringify({
958
957
  items: t,
959
958
  metadata: n,
960
- coupon: h,
961
- couponCode: h
962
- }), _ = R(), F = {
959
+ coupon: d,
960
+ couponCode: d
961
+ }), _ = R(), N = {
963
962
  items: t,
964
963
  metadata: n,
965
964
  cartId: "",
@@ -967,12 +966,12 @@ class $e {
967
966
  cancelUrl: a,
968
967
  customerEmail: s,
969
968
  customerName: o,
970
- customerPhone: l,
969
+ customerPhone: c,
971
970
  shippingAddress: u,
972
971
  billingAddress: f,
973
- coupon: h,
974
- couponCode: h,
975
- tipAmount: p,
972
+ coupon: d,
973
+ couponCode: d,
974
+ tipAmount: y,
976
975
  shippingMethodId: g,
977
976
  paymentMethodId: m
978
977
  };
@@ -980,35 +979,35 @@ class $e {
980
979
  const S = await this.circuitBreaker.execute(async () => {
981
980
  const E = await P(
982
981
  async () => {
983
- const G = await this.routeDiscovery.buildUrl("/paywall/v1/cart/quote"), I = await y(G, {
982
+ const V = await this.routeDiscovery.buildUrl("/paywall/v1/cart/quote"), M = await p(V, {
984
983
  method: "POST",
985
984
  headers: {
986
985
  "Content-Type": "application/json",
987
986
  "Idempotency-Key": T
988
987
  },
989
- body: M
988
+ body: x
990
989
  });
991
- if (!I.ok) {
992
- const Y = await b(I, "Failed to create cart quote");
993
- throw k.fromResponse(I, Y);
990
+ if (!M.ok) {
991
+ const Q = await b(M, "Failed to create cart quote");
992
+ throw k.fromResponse(M, Q);
994
993
  }
995
- return await I.json();
994
+ return await M.json();
996
995
  },
997
996
  {
998
997
  ...C.IDEMPOTENT_WRITE,
999
998
  name: "stripe-cart-quote",
1000
- inFlightKey: `stripe:cart-quote:${M}`
999
+ inFlightKey: `stripe:cart-quote:${x}`
1001
1000
  }
1002
1001
  );
1003
1002
  if (!E.cartId)
1004
1003
  throw new Error("Invalid cart quote response: missing cartId");
1005
1004
  const L = JSON.stringify({
1006
- ...F,
1005
+ ...N,
1007
1006
  cartId: E.cartId
1008
1007
  });
1009
1008
  return await P(
1010
1009
  async () => {
1011
- const G = await this.routeDiscovery.buildUrl("/paywall/v1/cart/checkout"), I = await y(G, {
1010
+ const V = await this.routeDiscovery.buildUrl("/paywall/v1/cart/checkout"), M = await p(V, {
1012
1011
  method: "POST",
1013
1012
  headers: {
1014
1013
  "Content-Type": "application/json",
@@ -1016,11 +1015,11 @@ class $e {
1016
1015
  },
1017
1016
  body: L
1018
1017
  });
1019
- if (!I.ok) {
1020
- const Y = await b(I, "Failed to create cart checkout session");
1021
- throw k.fromResponse(I, Y);
1018
+ if (!M.ok) {
1019
+ const Q = await b(M, "Failed to create cart checkout session");
1020
+ throw k.fromResponse(M, Q);
1022
1021
  }
1023
- return await I.json();
1022
+ return await M.json();
1024
1023
  },
1025
1024
  {
1026
1025
  ...C.IDEMPOTENT_WRITE,
@@ -1043,8 +1042,8 @@ class $e {
1043
1042
  }
1044
1043
  class je {
1045
1044
  routeDiscovery;
1046
- quoteRateLimiter = D(N.QUOTE);
1047
- verifyRateLimiter = D(N.PAYMENT);
1045
+ quoteRateLimiter = D(F.QUOTE);
1046
+ verifyRateLimiter = D(F.PAYMENT);
1048
1047
  circuitBreaker = H({
1049
1048
  failureThreshold: 5,
1050
1049
  timeout: 1e4,
@@ -1067,11 +1066,11 @@ class je {
1067
1066
  return await this.circuitBreaker.execute(async () => await P(
1068
1067
  async () => {
1069
1068
  const a = "/paywall/v1/quote";
1070
- c().debug(
1069
+ l().debug(
1071
1070
  "[X402Manager] Requesting quote",
1072
1071
  r ? "with coupon" : "without coupon"
1073
1072
  );
1074
- const n = await this.routeDiscovery.buildUrl(a), s = await y(n, {
1073
+ const n = await this.routeDiscovery.buildUrl(a), s = await p(n, {
1075
1074
  method: "POST",
1076
1075
  headers: {
1077
1076
  "Content-Type": "application/json"
@@ -1085,22 +1084,22 @@ class je {
1085
1084
  throw new Error(`Expected 402 status, got ${s.status}`);
1086
1085
  const o = await s.json();
1087
1086
  if (o.crypto) {
1088
- const l = o.crypto;
1089
- if (!this.validateRequirement(l))
1087
+ const c = o.crypto;
1088
+ if (!this.validateRequirement(c))
1090
1089
  throw new Error("Invalid x402 requirement received from server: missing required fields");
1091
- return l;
1090
+ return c;
1092
1091
  } else if (o.accepts && o.accepts.length > 0) {
1093
- const l = o.accepts[0];
1094
- if (!this.validateRequirement(l))
1092
+ const c = o.accepts[0];
1093
+ if (!this.validateRequirement(c))
1095
1094
  throw new Error("Invalid x402 requirement received from server: missing required fields");
1096
- return l;
1095
+ return c;
1097
1096
  } else
1098
1097
  throw new Error("Invalid x402 response: missing crypto or accepts field");
1099
1098
  },
1100
1099
  { ...C.QUICK, name: "x402-quote" }
1101
1100
  ));
1102
1101
  } catch (a) {
1103
- throw a instanceof v ? (c().error("[X402Manager] Circuit breaker is OPEN - x402 service unavailable"), new Error("Payment service is temporarily unavailable. Please try again in a few moments.")) : a;
1102
+ throw a instanceof v ? (l().error("[X402Manager] Circuit breaker is OPEN - x402 service unavailable"), new Error("Payment service is temporarily unavailable. Please try again in a few moments.")) : a;
1104
1103
  }
1105
1104
  }
1106
1105
  /**
@@ -1114,7 +1113,7 @@ class je {
1114
1113
  try {
1115
1114
  return await this.circuitBreaker.execute(async () => await P(
1116
1115
  async () => {
1117
- const s = await this.routeDiscovery.buildUrl("/paywall/v1/cart/quote"), l = await y(s, {
1116
+ const s = await this.routeDiscovery.buildUrl("/paywall/v1/cart/quote"), c = await p(s, {
1118
1117
  method: "POST",
1119
1118
  headers: {
1120
1119
  "Content-Type": "application/json",
@@ -1129,11 +1128,11 @@ class je {
1129
1128
  // Legacy Go server field (backwards compat)
1130
1129
  })
1131
1130
  });
1132
- if (l.status !== 402 && !l.ok) {
1133
- const f = await b(l, "Failed to get cart quote");
1131
+ if (c.status !== 402 && !c.ok) {
1132
+ const f = await b(c, "Failed to get cart quote");
1134
1133
  throw new Error(f);
1135
1134
  }
1136
- const u = await l.json();
1135
+ const u = await c.json();
1137
1136
  if (!u.cartId || !u.quote)
1138
1137
  throw new Error("Invalid cart quote response: missing cartId or quote");
1139
1138
  if (u.quote.crypto && !this.validateRequirement(u.quote.crypto))
@@ -1143,7 +1142,7 @@ class je {
1143
1142
  { ...C.QUICK, name: "x402-cart-quote" }
1144
1143
  ));
1145
1144
  } catch (s) {
1146
- throw s instanceof v ? (c().error("[X402Manager] Circuit breaker is OPEN - cart quote service unavailable"), new Error("Payment service is temporarily unavailable. Please try again in a few moments.")) : s;
1145
+ throw s instanceof v ? (l().error("[X402Manager] Circuit breaker is OPEN - cart quote service unavailable"), new Error("Payment service is temporarily unavailable. Please try again in a few moments.")) : s;
1147
1146
  }
1148
1147
  }
1149
1148
  /**
@@ -1162,9 +1161,9 @@ class je {
1162
1161
  return null;
1163
1162
  try {
1164
1163
  const r = re.decode(t), a = JSON.parse(r);
1165
- return typeof a.success != "boolean" ? (c().error("Invalid settlement response: missing success field"), null) : a;
1164
+ return typeof a.success != "boolean" ? (l().error("Invalid settlement response: missing success field"), null) : a;
1166
1165
  } catch (r) {
1167
- return c().error("Failed to parse settlement response:", r), null;
1166
+ return l().error("Failed to parse settlement response:", r), null;
1168
1167
  }
1169
1168
  }
1170
1169
  /**
@@ -1203,13 +1202,13 @@ class je {
1203
1202
  // Add coupon if present
1204
1203
  }
1205
1204
  }
1206
- }, f = this.buildPaymentHeader(u), h = "/paywall/v1/verify";
1207
- c().debug("[X402Manager] Submitting payment", {
1205
+ }, f = this.buildPaymentHeader(u), d = "/paywall/v1/verify";
1206
+ l().debug("[X402Manager] Submitting payment", {
1208
1207
  resourceType: s,
1209
1208
  hasCoupon: !!a,
1210
1209
  hasMetadata: !!n
1211
1210
  });
1212
- const p = await this.routeDiscovery.buildUrl(h), g = await y(p, {
1211
+ const y = await this.routeDiscovery.buildUrl(d), g = await p(y, {
1213
1212
  method: "POST",
1214
1213
  headers: {
1215
1214
  "Content-Type": "application/json",
@@ -1218,14 +1217,14 @@ class je {
1218
1217
  }
1219
1218
  });
1220
1219
  if (g.ok) {
1221
- const { settlement: d, transactionId: w } = await this.handlePaymentVerification(
1220
+ const { settlement: h, transactionId: w } = await this.handlePaymentVerification(
1222
1221
  g,
1223
1222
  r.payload.signature
1224
1223
  );
1225
1224
  return {
1226
1225
  success: !0,
1227
1226
  transactionId: w,
1228
- settlement: d || void 0
1227
+ settlement: h || void 0
1229
1228
  };
1230
1229
  }
1231
1230
  return {
@@ -1235,13 +1234,13 @@ class je {
1235
1234
  },
1236
1235
  { maxRetries: 0, initialDelayMs: 0, backoffFactor: 1, maxDelayMs: 0, name: "x402-verify" }
1237
1236
  ));
1238
- } catch (l) {
1239
- return l instanceof v ? {
1237
+ } catch (c) {
1238
+ return c instanceof v ? {
1240
1239
  success: !1,
1241
1240
  error: "Payment verification service is temporarily unavailable. Please try again in a few moments."
1242
1241
  } : {
1243
1242
  success: !1,
1244
- error: O(l, "Unknown error")
1243
+ error: O(c, "Unknown error")
1245
1244
  };
1246
1245
  }
1247
1246
  }
@@ -1258,7 +1257,7 @@ class je {
1258
1257
  async () => {
1259
1258
  const s = await this.routeDiscovery.buildUrl(
1260
1259
  "/paywall/v1/gasless-transaction"
1261
- ), o = await y(s, {
1260
+ ), o = await p(s, {
1262
1261
  method: "POST",
1263
1262
  headers: {
1264
1263
  "Content-Type": "application/json"
@@ -1271,15 +1270,15 @@ class je {
1271
1270
  })
1272
1271
  });
1273
1272
  if (!o.ok) {
1274
- const l = await b(o, "Failed to build gasless transaction");
1275
- throw new Error(l);
1273
+ const c = await b(o, "Failed to build gasless transaction");
1274
+ throw new Error(c);
1276
1275
  }
1277
1276
  return await o.json();
1278
1277
  },
1279
1278
  { ...C.QUICK, name: "x402-gasless-build" }
1280
1279
  ));
1281
1280
  } catch (s) {
1282
- throw s instanceof v ? (c().error("[X402Manager] Circuit breaker is OPEN - gasless transaction service unavailable"), new Error("Gasless transaction service is temporarily unavailable. Please try again in a few moments.")) : s;
1281
+ throw s instanceof v ? (l().error("[X402Manager] Circuit breaker is OPEN - gasless transaction service unavailable"), new Error("Gasless transaction service is temporarily unavailable. Please try again in a few moments.")) : s;
1283
1282
  }
1284
1283
  }
1285
1284
  /**
@@ -1301,7 +1300,7 @@ class je {
1301
1300
  success: !1,
1302
1301
  error: "Rate limit exceeded for gasless transaction verification. Please try again later."
1303
1302
  };
1304
- const l = R();
1303
+ const c = R();
1305
1304
  try {
1306
1305
  return await this.circuitBreaker.execute(async () => await P(
1307
1306
  async () => {
@@ -1321,12 +1320,12 @@ class je {
1321
1320
  ...a ? { couponCode: a } : {}
1322
1321
  }
1323
1322
  }
1324
- }, h = this.buildPaymentHeader(f), g = await this.routeDiscovery.buildUrl("/paywall/v1/verify"), m = await y(g, {
1323
+ }, d = this.buildPaymentHeader(f), g = await this.routeDiscovery.buildUrl("/paywall/v1/verify"), m = await p(g, {
1325
1324
  method: "POST",
1326
1325
  headers: {
1327
1326
  "Content-Type": "application/json",
1328
- "X-PAYMENT": h,
1329
- "Idempotency-Key": l
1327
+ "X-PAYMENT": d,
1328
+ "Idempotency-Key": c
1330
1329
  }
1331
1330
  });
1332
1331
  if (m.ok) {
@@ -1371,7 +1370,7 @@ class je {
1371
1370
  try {
1372
1371
  n = (await e.json()).signature || t;
1373
1372
  } catch (s) {
1374
- c().warn("Failed to parse JSON response body:", s);
1373
+ l().warn("Failed to parse JSON response body:", s);
1375
1374
  }
1376
1375
  return { settlement: r, transactionId: n };
1377
1376
  }
@@ -1382,14 +1381,14 @@ class je {
1382
1381
  return !!(e.scheme && e.network && e.maxAmountRequired && e.resource && e.payTo && e.asset && e.maxTimeoutSeconds > 0);
1383
1382
  }
1384
1383
  }
1385
- class He {
1384
+ class $e {
1386
1385
  stripe = null;
1387
1386
  initPromise = null;
1388
1387
  publicKey;
1389
1388
  routeDiscovery;
1390
1389
  // Separate rate limiters for different operation types
1391
- sessionRateLimiter = D(N.PAYMENT);
1392
- statusRateLimiter = D(N.QUOTE);
1390
+ sessionRateLimiter = D(F.PAYMENT);
1391
+ statusRateLimiter = D(F.QUOTE);
1393
1392
  circuitBreaker = H({
1394
1393
  failureThreshold: 5,
1395
1394
  timeout: 1e4,
@@ -1422,7 +1421,7 @@ class He {
1422
1421
  */
1423
1422
  async initialize() {
1424
1423
  this.stripe || (this.initPromise || (this.initPromise = (async () => {
1425
- if (this.stripe = await ue(this.publicKey), !this.stripe) throw new Error("Failed to initialize Stripe");
1424
+ if (this.stripe = await he(this.publicKey), !this.stripe) throw new Error("Failed to initialize Stripe");
1426
1425
  })()), await this.initPromise);
1427
1426
  }
1428
1427
  /** Internal helper: execute with rate limiting, circuit breaker, and retry */
@@ -1434,7 +1433,7 @@ class He {
1434
1433
  () => P(t, { ...n, name: r })
1435
1434
  );
1436
1435
  } catch (s) {
1437
- throw s instanceof v ? (c().error(`[SubscriptionManager] Circuit breaker OPEN for ${a}`), new Error("Service temporarily unavailable. Please try again in a few moments.")) : s;
1436
+ throw s instanceof v ? (l().error(`[SubscriptionManager] Circuit breaker OPEN for ${a}`), new Error("Service temporarily unavailable. Please try again in a few moments.")) : s;
1438
1437
  }
1439
1438
  }
1440
1439
  /**
@@ -1448,12 +1447,12 @@ class He {
1448
1447
  return await this.circuitBreaker.execute(async () => await P(
1449
1448
  async () => {
1450
1449
  const a = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/stripe-session");
1451
- c().debug("[SubscriptionManager] Creating subscription session:", {
1450
+ l().debug("[SubscriptionManager] Creating subscription session:", {
1452
1451
  resource: e.resource,
1453
1452
  interval: e.interval,
1454
1453
  trialDays: e.trialDays
1455
1454
  });
1456
- const n = await y(a, {
1455
+ const n = await p(a, {
1457
1456
  method: "POST",
1458
1457
  headers: {
1459
1458
  "Content-Type": "application/json",
@@ -1477,7 +1476,7 @@ class He {
1477
1476
  }
1478
1477
  ));
1479
1478
  } catch (a) {
1480
- throw a instanceof v ? (c().error("[SubscriptionManager] Circuit breaker is OPEN - service unavailable"), new Error(
1479
+ throw a instanceof v ? (l().error("[SubscriptionManager] Circuit breaker is OPEN - service unavailable"), new Error(
1481
1480
  "Subscription service is temporarily unavailable. Please try again in a few moments."
1482
1481
  )) : a;
1483
1482
  }
@@ -1532,8 +1531,8 @@ class He {
1532
1531
  }), r = await this.routeDiscovery.buildUrl(
1533
1532
  `/paywall/v1/subscription/status?${t.toString()}`
1534
1533
  );
1535
- c().debug("[SubscriptionManager] Checking subscription status:", e);
1536
- const a = await y(r, {
1534
+ l().debug("[SubscriptionManager] Checking subscription status:", e);
1535
+ const a = await p(r, {
1537
1536
  method: "GET",
1538
1537
  headers: {
1539
1538
  "Content-Type": "application/json"
@@ -1551,7 +1550,7 @@ class He {
1551
1550
  { ...C.STANDARD, name: "subscription-status-check" }
1552
1551
  ));
1553
1552
  } catch (t) {
1554
- throw t instanceof v ? (c().error("[SubscriptionManager] Circuit breaker is OPEN for status check"), new Error(
1553
+ throw t instanceof v ? (l().error("[SubscriptionManager] Circuit breaker is OPEN for status check"), new Error(
1555
1554
  "Subscription status service is temporarily unavailable. Please try again in a few moments."
1556
1555
  )) : t;
1557
1556
  }
@@ -1571,8 +1570,8 @@ class He {
1571
1570
  couponCode: r?.couponCode,
1572
1571
  intervalDays: r?.intervalDays
1573
1572
  };
1574
- c().debug("[SubscriptionManager] Requesting subscription quote:", n);
1575
- const s = await y(a, {
1573
+ l().debug("[SubscriptionManager] Requesting subscription quote:", n);
1574
+ const s = await p(a, {
1576
1575
  method: "POST",
1577
1576
  headers: {
1578
1577
  "Content-Type": "application/json"
@@ -1591,7 +1590,7 @@ class He {
1591
1590
  { ...C.STANDARD, name: "subscription-quote" }
1592
1591
  ));
1593
1592
  } catch (a) {
1594
- throw a instanceof v ? (c().error("[SubscriptionManager] Circuit breaker is OPEN for quote"), new Error(
1593
+ throw a instanceof v ? (l().error("[SubscriptionManager] Circuit breaker is OPEN for quote"), new Error(
1595
1594
  "Subscription quote service is temporarily unavailable. Please try again in a few moments."
1596
1595
  )) : a;
1597
1596
  }
@@ -1603,8 +1602,8 @@ class He {
1603
1602
  this.sessionRateLimiter,
1604
1603
  async () => {
1605
1604
  const r = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/x402/activate");
1606
- c().debug("[SubscriptionManager] Activating x402 subscription:", e);
1607
- const a = await y(r, {
1605
+ l().debug("[SubscriptionManager] Activating x402 subscription:", e);
1606
+ const a = await p(r, {
1608
1607
  method: "POST",
1609
1608
  headers: { "Content-Type": "application/json" },
1610
1609
  body: t
@@ -1625,10 +1624,10 @@ class He {
1625
1624
  );
1626
1625
  }
1627
1626
  }
1628
- class Be {
1627
+ class He {
1629
1628
  routeDiscovery;
1630
- rateLimiter = D(N.PAYMENT);
1631
- queryRateLimiter = D(N.QUOTE);
1629
+ rateLimiter = D(F.PAYMENT);
1630
+ queryRateLimiter = D(F.QUOTE);
1632
1631
  circuitBreaker = H({
1633
1632
  failureThreshold: 5,
1634
1633
  timeout: 1e4,
@@ -1646,7 +1645,7 @@ class Be {
1646
1645
  () => P(t, { ...n, name: r })
1647
1646
  );
1648
1647
  } catch (s) {
1649
- throw s instanceof v ? (c().error(`[SubscriptionChangeManager] Circuit breaker OPEN for ${a}`), new Error("Service temporarily unavailable. Please try again in a few moments.")) : s;
1648
+ throw s instanceof v ? (l().error(`[SubscriptionChangeManager] Circuit breaker OPEN for ${a}`), new Error("Service temporarily unavailable. Please try again in a few moments.")) : s;
1650
1649
  }
1651
1650
  }
1652
1651
  /** Change subscription plan (upgrade or downgrade) */
@@ -1656,8 +1655,8 @@ class Be {
1656
1655
  this.rateLimiter,
1657
1656
  async () => {
1658
1657
  const a = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/change");
1659
- c().debug("[SubscriptionChangeManager] Changing subscription:", e);
1660
- const n = await y(a, {
1658
+ l().debug("[SubscriptionChangeManager] Changing subscription:", e);
1659
+ const n = await p(a, {
1661
1660
  method: "POST",
1662
1661
  headers: { "Content-Type": "application/json", "Idempotency-Key": t },
1663
1662
  body: r
@@ -1683,8 +1682,8 @@ class Be {
1683
1682
  this.queryRateLimiter,
1684
1683
  async () => {
1685
1684
  const t = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/change/preview");
1686
- c().debug("[SubscriptionChangeManager] Previewing subscription change:", e);
1687
- const r = await y(t, {
1685
+ l().debug("[SubscriptionChangeManager] Previewing subscription change:", e);
1686
+ const r = await p(t, {
1688
1687
  method: "POST",
1689
1688
  headers: { "Content-Type": "application/json" },
1690
1689
  body: JSON.stringify(e)
@@ -1703,8 +1702,8 @@ class Be {
1703
1702
  this.queryRateLimiter,
1704
1703
  async () => {
1705
1704
  const r = new URLSearchParams({ resource: e, userId: t }), a = await this.routeDiscovery.buildUrl(`/paywall/v1/subscription/details?${r}`);
1706
- c().debug("[SubscriptionChangeManager] Getting subscription details:", { resource: e, userId: t });
1707
- const n = await y(a, {
1705
+ l().debug("[SubscriptionChangeManager] Getting subscription details:", { resource: e, userId: t });
1706
+ const n = await p(a, {
1708
1707
  method: "GET",
1709
1708
  headers: { "Content-Type": "application/json" }
1710
1709
  });
@@ -1723,8 +1722,8 @@ class Be {
1723
1722
  this.rateLimiter,
1724
1723
  async () => {
1725
1724
  const r = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/cancel");
1726
- c().debug("[SubscriptionChangeManager] Canceling subscription:", e);
1727
- const a = await y(r, {
1725
+ l().debug("[SubscriptionChangeManager] Canceling subscription:", e);
1726
+ const a = await p(r, {
1728
1727
  method: "POST",
1729
1728
  headers: { "Content-Type": "application/json" },
1730
1729
  body: t
@@ -1751,8 +1750,8 @@ class Be {
1751
1750
  this.queryRateLimiter,
1752
1751
  async () => {
1753
1752
  const r = await this.routeDiscovery.buildUrl("/paywall/v1/subscription/portal");
1754
- c().debug("[SubscriptionChangeManager] Getting billing portal URL:", e);
1755
- const a = await y(r, {
1753
+ l().debug("[SubscriptionChangeManager] Getting billing portal URL:", e);
1754
+ const a = await p(r, {
1756
1755
  method: "POST",
1757
1756
  headers: { "Content-Type": "application/json" },
1758
1757
  body: t
@@ -1775,7 +1774,7 @@ class Be {
1775
1774
  }
1776
1775
  class Ke {
1777
1776
  routeDiscovery;
1778
- rateLimiter = D(N.PAYMENT);
1777
+ rateLimiter = D(F.PAYMENT);
1779
1778
  circuitBreaker = H({
1780
1779
  failureThreshold: 5,
1781
1780
  timeout: 1e4,
@@ -1791,8 +1790,8 @@ class Ke {
1791
1790
  return await this.circuitBreaker.execute(async () => await P(
1792
1791
  async () => {
1793
1792
  const r = await this.routeDiscovery.buildUrl("/paywall/v1/quote");
1794
- c().debug("[CreditsManager] Requesting quote");
1795
- const a = await y(r, {
1793
+ l().debug("[CreditsManager] Requesting quote");
1794
+ const a = await p(r, {
1796
1795
  method: "POST",
1797
1796
  headers: { "Content-Type": "application/json" },
1798
1797
  body: JSON.stringify({ resource: e, couponCode: t })
@@ -1808,7 +1807,7 @@ class Ke {
1808
1807
  { ...C.STANDARD, name: "credits-quote" }
1809
1808
  ));
1810
1809
  } catch (r) {
1811
- throw r instanceof v ? (c().error("[CreditsManager] Circuit breaker is OPEN - credits service unavailable"), new Error("Credits service is temporarily unavailable. Please try again in a few moments.")) : r;
1810
+ throw r instanceof v ? (l().error("[CreditsManager] Circuit breaker is OPEN - credits service unavailable"), new Error("Credits service is temporarily unavailable. Please try again in a few moments.")) : r;
1812
1811
  }
1813
1812
  }
1814
1813
  async requestCartQuote(e, t) {
@@ -1818,8 +1817,8 @@ class Ke {
1818
1817
  return await this.circuitBreaker.execute(async () => await P(
1819
1818
  async () => {
1820
1819
  const r = await this.routeDiscovery.buildUrl("/paywall/v1/cart/quote");
1821
- c().debug("[CreditsManager] Requesting cart quote for items:", e.length);
1822
- const a = await y(r, {
1820
+ l().debug("[CreditsManager] Requesting cart quote for items:", e.length);
1821
+ const a = await p(r, {
1823
1822
  method: "POST",
1824
1823
  headers: { "Content-Type": "application/json" },
1825
1824
  body: JSON.stringify({ items: e, couponCode: t })
@@ -1853,8 +1852,8 @@ class Ke {
1853
1852
  return await this.circuitBreaker.execute(async () => await P(
1854
1853
  async () => {
1855
1854
  const o = await this.routeDiscovery.buildUrl("/paywall/v1/credits/hold");
1856
- c().debug("[CreditsManager] Creating hold");
1857
- const l = await y(o, {
1855
+ l().debug("[CreditsManager] Creating hold");
1856
+ const c = await p(o, {
1858
1857
  method: "POST",
1859
1858
  headers: {
1860
1859
  "Content-Type": "application/json",
@@ -1863,11 +1862,11 @@ class Ke {
1863
1862
  },
1864
1863
  body: s
1865
1864
  });
1866
- if (!l.ok) {
1867
- const u = await b(l, "Failed to create credits hold");
1868
- throw k.fromResponse(l, u);
1865
+ if (!c.ok) {
1866
+ const u = await b(c, "Failed to create credits hold");
1867
+ throw k.fromResponse(c, u);
1869
1868
  }
1870
- return await l.json();
1869
+ return await c.json();
1871
1870
  },
1872
1871
  {
1873
1872
  ...C.IDEMPOTENT_WRITE,
@@ -1892,8 +1891,8 @@ class Ke {
1892
1891
  return await this.circuitBreaker.execute(async () => await P(
1893
1892
  async () => {
1894
1893
  const n = await this.routeDiscovery.buildUrl(`/paywall/v1/cart/${encodeURIComponent(t)}/credits/hold`);
1895
- c().debug("[CreditsManager] Creating cart hold for cart:", t);
1896
- const s = await y(n, {
1894
+ l().debug("[CreditsManager] Creating cart hold for cart:", t);
1895
+ const s = await p(n, {
1897
1896
  method: "POST",
1898
1897
  headers: {
1899
1898
  "Content-Type": "application/json",
@@ -1926,7 +1925,7 @@ class Ke {
1926
1925
  error: "Rate limit exceeded for credits authorization. Please try again later.",
1927
1926
  errorCode: "rate_limit_exceeded"
1928
1927
  };
1929
- const o = R(), l = JSON.stringify({
1928
+ const o = R(), c = JSON.stringify({
1930
1929
  resource: t,
1931
1930
  holdId: r,
1932
1931
  couponCode: a,
@@ -1936,21 +1935,21 @@ class Ke {
1936
1935
  return await this.circuitBreaker.execute(async () => await P(
1937
1936
  async () => {
1938
1937
  const u = await this.routeDiscovery.buildUrl("/paywall/v1/credits/authorize");
1939
- c().debug("[CreditsManager] Authorizing payment");
1940
- const f = await y(u, {
1938
+ l().debug("[CreditsManager] Authorizing payment");
1939
+ const f = await p(u, {
1941
1940
  method: "POST",
1942
1941
  headers: {
1943
1942
  "Content-Type": "application/json",
1944
1943
  Authorization: `Bearer ${n}`,
1945
1944
  "Idempotency-Key": o
1946
1945
  },
1947
- body: l
1946
+ body: c
1948
1947
  });
1949
1948
  if (!f.ok) {
1950
- const p = await f.json().catch(() => ({}));
1949
+ const y = await f.json().catch(() => ({}));
1951
1950
  throw k.fromResponse(
1952
1951
  f,
1953
- p.error?.message || "Credits authorization failed"
1952
+ y.error?.message || "Credits authorization failed"
1954
1953
  );
1955
1954
  }
1956
1955
  return {
@@ -1961,7 +1960,7 @@ class Ke {
1961
1960
  {
1962
1961
  ...C.IDEMPOTENT_WRITE,
1963
1962
  name: "credits-authorize",
1964
- inFlightKey: `credits:authorize:${n}:${l}`
1963
+ inFlightKey: `credits:authorize:${n}:${c}`
1965
1964
  }
1966
1965
  ));
1967
1966
  } catch (u) {
@@ -1991,9 +1990,9 @@ class Ke {
1991
1990
  try {
1992
1991
  return await this.circuitBreaker.execute(async () => await P(
1993
1992
  async () => {
1994
- const l = await this.routeDiscovery.buildUrl(`/paywall/v1/cart/${encodeURIComponent(t)}/credits/authorize`);
1995
- c().debug("[CreditsManager] Authorizing cart payment for cart:", t);
1996
- const u = await y(l, {
1993
+ const c = await this.routeDiscovery.buildUrl(`/paywall/v1/cart/${encodeURIComponent(t)}/credits/authorize`);
1994
+ l().debug("[CreditsManager] Authorizing cart payment for cart:", t);
1995
+ const u = await p(c, {
1997
1996
  method: "POST",
1998
1997
  headers: {
1999
1998
  "Content-Type": "application/json",
@@ -2003,14 +2002,14 @@ class Ke {
2003
2002
  body: o
2004
2003
  });
2005
2004
  if (!u.ok) {
2006
- const h = await u.json().catch((p) => (c().error("[CreditsManager] Failed to parse error response JSON:", p, {
2005
+ const d = await u.json().catch((y) => (l().error("[CreditsManager] Failed to parse error response JSON:", y, {
2007
2006
  cartId: t,
2008
2007
  status: u.status,
2009
2008
  statusText: u.statusText
2010
2009
  }), {}));
2011
2010
  throw k.fromResponse(
2012
2011
  u,
2013
- h.error?.message || "Cart credits authorization failed"
2012
+ d.error?.message || "Cart credits authorization failed"
2014
2013
  );
2015
2014
  }
2016
2015
  return {
@@ -2024,14 +2023,14 @@ class Ke {
2024
2023
  inFlightKey: `credits:cart-authorize:${a}:${t}:${o}`
2025
2024
  }
2026
2025
  ));
2027
- } catch (l) {
2028
- return l instanceof v ? {
2026
+ } catch (c) {
2027
+ return c instanceof v ? {
2029
2028
  success: !1,
2030
2029
  error: "Credits service is temporarily unavailable. Please try again in a few moments.",
2031
2030
  errorCode: "service_unavailable"
2032
2031
  } : {
2033
2032
  success: !1,
2034
- error: O(l, "Cart credits authorization failed"),
2033
+ error: O(c, "Cart credits authorization failed"),
2035
2034
  errorCode: "authorization_failed"
2036
2035
  };
2037
2036
  }
@@ -2040,7 +2039,7 @@ class Ke {
2040
2039
  if (e)
2041
2040
  try {
2042
2041
  await this.circuitBreaker.execute(async () => {
2043
- const r = await this.routeDiscovery.buildUrl(`/paywall/v1/credits/hold/${encodeURIComponent(e)}/release`), a = await y(r, {
2042
+ const r = await this.routeDiscovery.buildUrl(`/paywall/v1/credits/hold/${encodeURIComponent(e)}/release`), a = await p(r, {
2044
2043
  method: "POST",
2045
2044
  headers: {
2046
2045
  Authorization: `Bearer ${t}`,
@@ -2079,8 +2078,8 @@ class Ke {
2079
2078
  if (!o.success && n)
2080
2079
  try {
2081
2080
  await this.releaseHold(n, t);
2082
- } catch (l) {
2083
- c().warn("[CreditsManager] Failed to release hold after auth failure:", l);
2081
+ } catch (c) {
2082
+ l().warn("[CreditsManager] Failed to release hold after auth failure:", c);
2084
2083
  }
2085
2084
  return {
2086
2085
  success: o.success,
@@ -2092,7 +2091,7 @@ class Ke {
2092
2091
  try {
2093
2092
  await this.releaseHold(n, t);
2094
2093
  } catch (o) {
2095
- c().warn("[CreditsManager] Failed to release hold after payment failure:", o);
2094
+ l().warn("[CreditsManager] Failed to release hold after payment failure:", o);
2096
2095
  }
2097
2096
  return {
2098
2097
  success: !1,
@@ -2103,7 +2102,7 @@ class Ke {
2103
2102
  async getBalance(e) {
2104
2103
  try {
2105
2104
  return await this.circuitBreaker.execute(async () => {
2106
- const t = await this.routeDiscovery.buildUrl("/paywall/v1/credits/balance"), r = await y(t, {
2105
+ const t = await this.routeDiscovery.buildUrl("/paywall/v1/credits/balance"), r = await p(t, {
2107
2106
  method: "GET",
2108
2107
  headers: { Authorization: `Bearer ${e}` }
2109
2108
  });
@@ -2118,7 +2117,7 @@ class Ke {
2118
2117
  }
2119
2118
  }
2120
2119
  }
2121
- class We {
2120
+ class ze {
2122
2121
  serverUrl;
2123
2122
  getLogger;
2124
2123
  fetchWithTimeout;
@@ -2186,17 +2185,17 @@ class We {
2186
2185
  this.routePrefix = null, this.discoveryPromise = null, this.failedDiscoveryAt = null;
2187
2186
  }
2188
2187
  }
2189
- class ze extends We {
2188
+ class We extends ze {
2190
2189
  constructor(e) {
2191
- super(e, { getLogger: c, fetchWithTimeout: y });
2190
+ super(e, { getLogger: l, fetchWithTimeout: p });
2192
2191
  }
2193
2192
  }
2194
2193
  let X = null;
2195
2194
  async function Je() {
2196
- return X || (X = (await import("./WalletManager-D-eoqUDy.mjs")).WalletManager), X;
2195
+ return X || (X = (await import("./WalletManager-CGR69MiR.mjs")).WalletManager), X;
2197
2196
  }
2198
- const J = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map();
2199
- function de(i, e, t, r, a, n) {
2197
+ const Y = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map();
2198
+ function me(i, e, t, r, a, n) {
2200
2199
  return JSON.stringify({
2201
2200
  stripePublicKey: i,
2202
2201
  serverUrl: e,
@@ -2207,7 +2206,7 @@ function de(i, e, t, r, a, n) {
2207
2206
  });
2208
2207
  }
2209
2208
  async function Ge(i, e, t, r, a, n) {
2210
- const s = de(
2209
+ const s = me(
2211
2210
  i,
2212
2211
  e,
2213
2212
  t,
@@ -2215,33 +2214,33 @@ async function Ge(i, e, t, r, a, n) {
2215
2214
  a,
2216
2215
  n
2217
2216
  );
2218
- let o = J.get(s);
2217
+ let o = Y.get(s);
2219
2218
  if (o)
2220
- return o.refCount++, c().debug(
2219
+ return o.refCount++, l().debug(
2221
2220
  `[ManagerCache] Reusing cached managers (refCount: ${o.refCount}):`,
2222
2221
  { stripePublicKey: i.slice(0, 10) + "...", serverUrl: e }
2223
2222
  ), o;
2224
- const l = Z.get(s);
2225
- if (l)
2226
- return o = await l, o.refCount++, c().debug(
2223
+ const c = Z.get(s);
2224
+ if (c)
2225
+ return o = await c, o.refCount++, l().debug(
2227
2226
  `[ManagerCache] Reusing in-flight managers (refCount: ${o.refCount}):`,
2228
2227
  { stripePublicKey: i.slice(0, 10) + "...", serverUrl: e }
2229
2228
  ), o;
2230
- c().debug(
2229
+ l().debug(
2231
2230
  "[ManagerCache] Creating new manager instances:",
2232
2231
  { stripePublicKey: i.slice(0, 10) + "...", serverUrl: e }
2233
2232
  );
2234
2233
  const u = (async () => {
2235
- const f = new ze(e), h = new $e(i, f, n ?? !1), p = new je(f), g = await Je(), m = new g(
2234
+ const f = new We(e), d = new Ue(i, f, n ?? !1), y = new je(f), g = await Je(), m = new g(
2236
2235
  t,
2237
2236
  r,
2238
2237
  a ?? !1
2239
- ), d = new He(i, f), w = new Be(f), T = new Ke(f);
2238
+ ), h = new $e(i, f), w = new He(f), T = new Ke(f);
2240
2239
  return {
2241
- stripeManager: h,
2242
- x402Manager: p,
2240
+ stripeManager: d,
2241
+ x402Manager: y,
2243
2242
  walletManager: m,
2244
- subscriptionManager: d,
2243
+ subscriptionManager: h,
2245
2244
  subscriptionChangeManager: w,
2246
2245
  creditsManager: T,
2247
2246
  routeDiscovery: f,
@@ -2250,28 +2249,28 @@ async function Ge(i, e, t, r, a, n) {
2250
2249
  })();
2251
2250
  Z.set(s, u);
2252
2251
  try {
2253
- return o = await u, J.set(s, o), o;
2252
+ return o = await u, Y.set(s, o), o;
2254
2253
  } finally {
2255
2254
  Z.delete(s);
2256
2255
  }
2257
2256
  }
2258
2257
  function ie(i, e, t, r, a, n) {
2259
- const s = de(
2258
+ const s = me(
2260
2259
  i,
2261
2260
  e,
2262
2261
  t,
2263
2262
  r,
2264
2263
  a,
2265
2264
  n
2266
- ), o = J.get(s);
2265
+ ), o = Y.get(s);
2267
2266
  if (!o) {
2268
- c().warn("[ManagerCache] Attempted to release non-existent managers:", { cacheKey: s });
2267
+ l().warn("[ManagerCache] Attempted to release non-existent managers:", { cacheKey: s });
2269
2268
  return;
2270
2269
  }
2271
- o.refCount--, c().debug(
2270
+ o.refCount--, l().debug(
2272
2271
  `[ManagerCache] Released manager reference (refCount: ${o.refCount}):`,
2273
2272
  { stripePublicKey: i.slice(0, 10) + "...", serverUrl: e }
2274
- ), o.refCount <= 0 && (J.delete(s), c().debug("[ManagerCache] Removed managers from cache (refCount reached 0)"));
2273
+ ), o.refCount <= 0 && (Y.delete(s), l().debug("[ManagerCache] Removed managers from cache (refCount reached 0)"));
2275
2274
  }
2276
2275
  function Ye(i) {
2277
2276
  return `CEDROS_FEATURE_${i.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_+|_+$/g, "").toUpperCase()}`;
@@ -2289,14 +2288,14 @@ function Ve(i) {
2289
2288
  ]);
2290
2289
  return Object.freeze(Object.fromEntries(e));
2291
2290
  }
2292
- const q = Ve({
2291
+ const U = Ve({
2293
2292
  complianceCheck: {
2294
2293
  description: "Enable pre-flight compliance checks before Stripe checkout.",
2295
2294
  default: !1,
2296
2295
  stage: "stable"
2297
2296
  }
2298
- }), he = Object.freeze(
2299
- Object.keys(q)
2297
+ }), ye = Object.freeze(
2298
+ Object.keys(U)
2300
2299
  );
2301
2300
  function Qe() {
2302
2301
  return typeof process < "u" && process.env ? process.env : {};
@@ -2304,7 +2303,7 @@ function Qe() {
2304
2303
  function te(i, e) {
2305
2304
  if (i)
2306
2305
  for (const [t, r] of Object.entries(i)) {
2307
- if (!(t in q))
2306
+ if (!(t in U))
2308
2307
  throw new Error(`Unknown feature flag "${t}" in ${e}`);
2309
2308
  if (typeof r != "boolean")
2310
2309
  throw new Error(`Feature flag "${t}" in ${e} must be a boolean`);
@@ -2320,13 +2319,13 @@ function Xe(i) {
2320
2319
  return !1;
2321
2320
  }
2322
2321
  }
2323
- function ut(i) {
2324
- return q[i];
2322
+ function yt(i) {
2323
+ return U[i];
2325
2324
  }
2326
- function dt() {
2327
- return he.map((i) => q[i]);
2325
+ function pt() {
2326
+ return ye.map((i) => U[i]);
2328
2327
  }
2329
- function fe(i = {}) {
2328
+ function pe(i = {}) {
2330
2329
  const e = i.env ?? Qe();
2331
2330
  te(
2332
2331
  i.featureFlags,
@@ -2336,14 +2335,14 @@ function fe(i = {}) {
2336
2335
  "fallbackFlags"
2337
2336
  );
2338
2337
  const t = {};
2339
- for (const r of he) {
2340
- const a = i.featureFlags?.[r], n = i.fallbackFlags?.[r], s = Xe(e[q[r].envVar]);
2341
- t[r] = a ?? n ?? s ?? q[r].default;
2338
+ for (const r of ye) {
2339
+ const a = i.featureFlags?.[r], n = i.fallbackFlags?.[r], s = Xe(e[U[r].envVar]);
2340
+ t[r] = a ?? n ?? s ?? U[r].default;
2342
2341
  }
2343
2342
  return t;
2344
2343
  }
2345
- function ht(i, e = {}) {
2346
- return fe(e)[i];
2344
+ function gt(i, e = {}) {
2345
+ return pe(e)[i];
2347
2346
  }
2348
2347
  function Ze(i, e = "featureFlags") {
2349
2348
  te(i, e);
@@ -2420,13 +2419,129 @@ ${a}`);
2420
2419
  const a = i.dangerouslyAllowUnknownMint === !0, n = Ce(i.tokenMint, "CedrosConfig.tokenMint", a);
2421
2420
  if (!n.isValid && n.error)
2422
2421
  throw new Error(n.error);
2423
- n.warning && c().warn(n.warning);
2422
+ n.warning && l().warn(n.warning);
2424
2423
  }
2425
2424
  return {
2426
2425
  ...i,
2427
2426
  serverUrl: r
2428
2427
  };
2429
2428
  }
2429
+ const rt = Object.freeze({
2430
+ surfaceBackground: "rgba(255, 255, 255, 0)",
2431
+ surfaceText: "#111827",
2432
+ surfaceBorder: "rgba(15, 23, 42, 0.08)",
2433
+ stripeBackground: "linear-gradient(135deg, #635bff 0%, #4f46e5 100%)",
2434
+ stripeText: "#ffffff",
2435
+ stripeShadow: "rgba(79, 70, 229, 0.25)",
2436
+ cryptoBackground: "linear-gradient(135deg, #14f195 0%, #9945ff 100%)",
2437
+ cryptoText: "#ffffff",
2438
+ cryptoShadow: "rgba(99, 102, 241, 0.25)",
2439
+ errorBackground: "#fee2e2",
2440
+ errorBorder: "#fca5a5",
2441
+ errorText: "#b91c1c",
2442
+ successBackground: "#dcfce7",
2443
+ successBorder: "#86efac",
2444
+ successText: "#166534",
2445
+ modalOverlay: "rgba(0, 0, 0, 0.5)",
2446
+ modalBackground: "#ffffff",
2447
+ modalBorder: "rgba(15, 23, 42, 0.08)",
2448
+ buttonBorderRadius: "8px",
2449
+ buttonPadding: "0.75rem 1.5rem",
2450
+ buttonFontSize: "1rem",
2451
+ buttonFontWeight: "600"
2452
+ }), at = Object.freeze({
2453
+ surfaceBackground: "rgba(17, 24, 39, 0.6)",
2454
+ surfaceText: "#f9fafb",
2455
+ surfaceBorder: "rgba(148, 163, 184, 0.25)",
2456
+ stripeBackground: "linear-gradient(135deg, #4f46e5 0%, #3730a3 100%)",
2457
+ stripeText: "#f5f3ff",
2458
+ stripeShadow: "rgba(99, 102, 241, 0.35)",
2459
+ cryptoBackground: "linear-gradient(135deg, #1dd4a6 0%, #6d28d9 100%)",
2460
+ cryptoText: "#ecfeff",
2461
+ cryptoShadow: "rgba(75, 85, 99, 0.35)",
2462
+ errorBackground: "#7f1d1d",
2463
+ errorBorder: "#fca5a5",
2464
+ errorText: "#fecaca",
2465
+ successBackground: "#14532d",
2466
+ successBorder: "#4ade80",
2467
+ successText: "#bbf7d0",
2468
+ modalOverlay: "rgba(0, 0, 0, 0.75)",
2469
+ modalBackground: "#1f2937",
2470
+ modalBorder: "rgba(148, 163, 184, 0.25)",
2471
+ buttonBorderRadius: "8px",
2472
+ buttonPadding: "0.75rem 1.5rem",
2473
+ buttonFontSize: "1rem",
2474
+ buttonFontWeight: "600"
2475
+ }), nt = {
2476
+ surfaceBackground: "--cedros-surface-bg",
2477
+ surfaceText: "--cedros-surface-text",
2478
+ surfaceBorder: "--cedros-surface-border",
2479
+ stripeBackground: "--cedros-stripe-bg",
2480
+ stripeText: "--cedros-stripe-text",
2481
+ stripeShadow: "--cedros-stripe-shadow",
2482
+ cryptoBackground: "--cedros-crypto-bg",
2483
+ cryptoText: "--cedros-crypto-text",
2484
+ cryptoShadow: "--cedros-crypto-shadow",
2485
+ errorBackground: "--cedros-error-bg",
2486
+ errorBorder: "--cedros-error-border",
2487
+ errorText: "--cedros-error-text",
2488
+ successBackground: "--cedros-success-bg",
2489
+ successBorder: "--cedros-success-border",
2490
+ successText: "--cedros-success-text",
2491
+ modalOverlay: "--cedros-modal-overlay",
2492
+ modalBackground: "--cedros-modal-bg",
2493
+ modalBorder: "--cedros-modal-border",
2494
+ buttonBorderRadius: "--cedros-button-radius",
2495
+ buttonPadding: "--cedros-button-padding",
2496
+ buttonFontSize: "--cedros-button-font-size",
2497
+ buttonFontWeight: "--cedros-button-font-weight"
2498
+ }, ge = le(null);
2499
+ function it(i, e) {
2500
+ return {
2501
+ ...i === "dark" ? at : rt,
2502
+ ...e
2503
+ };
2504
+ }
2505
+ function st(i) {
2506
+ const e = Object.entries(i).map(([t, r]) => [
2507
+ nt[t],
2508
+ r
2509
+ ]);
2510
+ return Object.fromEntries(e);
2511
+ }
2512
+ function ot({
2513
+ initialMode: i = "light",
2514
+ overrides: e,
2515
+ unstyled: t = !1,
2516
+ children: r
2517
+ }) {
2518
+ const [a, n] = q(i), [s, o] = q(e), c = ce(e);
2519
+ B(() => {
2520
+ if (e === c.current)
2521
+ return;
2522
+ (!e || !c.current ? e !== c.current : Object.keys({ ...e, ...c.current }).some(
2523
+ (d) => e[d] !== c.current?.[d]
2524
+ )) && (c.current = e, o(e));
2525
+ }, [e]);
2526
+ const u = G(() => {
2527
+ const f = it(a, s), d = t ? {} : st(f), y = t ? "" : `cedros-theme-root cedros-theme cedros-theme--${a}`;
2528
+ return {
2529
+ mode: a,
2530
+ setMode: n,
2531
+ tokens: f,
2532
+ className: y,
2533
+ style: d,
2534
+ unstyled: t
2535
+ };
2536
+ }, [a, s, t]);
2537
+ return /* @__PURE__ */ J(ge.Provider, { value: u, children: r });
2538
+ }
2539
+ function wt() {
2540
+ const i = oe(ge);
2541
+ if (!i)
2542
+ throw new Error("useCedrosTheme must be used within CedrosProvider");
2543
+ return i;
2544
+ }
2430
2545
  const ee = {
2431
2546
  getAdapters: () => [],
2432
2547
  cleanup: async () => {
@@ -2434,68 +2549,68 @@ const ee = {
2434
2549
  isInitialized: () => !1,
2435
2550
  getId: () => "stub"
2436
2551
  };
2437
- function rt() {
2552
+ function ct() {
2438
2553
  return typeof process < "u" && process.env.NODE_ENV === "development" ? 0 : 2;
2439
2554
  }
2440
- const me = ge(null);
2441
- function ft({ config: i, children: e }) {
2442
- const t = Q(() => tt(i), [i]), r = Q(
2443
- () => fe({
2555
+ const we = le(null);
2556
+ function vt({ config: i, children: e }) {
2557
+ const t = G(() => tt(i), [i]), r = G(
2558
+ () => pe({
2444
2559
  featureFlags: t.featureFlags,
2445
2560
  fallbackFlags: t.complianceCheck != null ? { complianceCheck: t.complianceCheck } : void 0
2446
2561
  }),
2447
2562
  [t.featureFlags, t.complianceCheck]
2448
- ), [a, n] = B(null), [s, o] = B(ee), l = ye(ee);
2449
- U(() => {
2563
+ ), [a, n] = q(null), [s, o] = q(ee), c = ce(ee);
2564
+ B(() => {
2450
2565
  let m = !1;
2451
- return import("./walletPool-9MylB2QK.mjs").then(({ createWalletPool: d }) => {
2566
+ return import("./walletPool-9MylB2QK.mjs").then(({ createWalletPool: h }) => {
2452
2567
  if (m) return;
2453
- const w = d();
2454
- l.current = w, o(w);
2455
- }).catch((d) => {
2456
- m || (c().error("[CedrosProvider] Wallet pool initialization failed:", d), n("Failed to initialize Cedros provider"));
2568
+ const w = h();
2569
+ c.current = w, o(w);
2570
+ }).catch((h) => {
2571
+ m || (l().error("[CedrosProvider] Wallet pool initialization failed:", h), n("Failed to initialize Cedros provider"));
2457
2572
  }), () => {
2458
2573
  m = !0;
2459
2574
  };
2460
2575
  }, []);
2461
- const [u, f] = B(null);
2462
- U(() => {
2576
+ const [u, f] = q(null);
2577
+ B(() => {
2463
2578
  let m = !1;
2464
2579
  return import("./solanaCheck-IlYsbXDd.mjs").then(
2465
- ({ checkSolanaAvailability: d }) => d()
2466
- ).then((d) => {
2467
- m || (d.available ? f(void 0) : f(d.error || "Solana dependencies not available"));
2468
- }).catch((d) => {
2469
- m || (c().warn("[CedrosProvider] Solana availability check failed:", d), f("Unable to verify Solana availability"));
2580
+ ({ checkSolanaAvailability: h }) => h()
2581
+ ).then((h) => {
2582
+ m || (h.available ? f(void 0) : f(h.error || "Solana dependencies not available"));
2583
+ }).catch((h) => {
2584
+ m || (l().warn("[CedrosProvider] Solana availability check failed:", h), f("Unable to verify Solana availability"));
2470
2585
  }), () => {
2471
2586
  m = !0;
2472
2587
  };
2473
- }, []), U(() => {
2474
- const m = t.logLevel ?? rt(), d = ve({
2588
+ }, []), B(() => {
2589
+ const m = t.logLevel ?? ct(), h = be({
2475
2590
  level: m,
2476
2591
  prefix: "[CedrosPay]"
2477
2592
  });
2478
- we(d);
2479
- }, [t.logLevel]), U(() => () => {
2480
- const m = l.current;
2481
- m && m !== ee && m.cleanup().catch((d) => {
2482
- c().warn("[CedrosProvider] Wallet pool cleanup failed:", d);
2593
+ ve(h);
2594
+ }, [t.logLevel]), B(() => () => {
2595
+ const m = c.current;
2596
+ m && m !== ee && m.cleanup().catch((h) => {
2597
+ l().warn("[CedrosProvider] Wallet pool cleanup failed:", h);
2483
2598
  });
2484
2599
  }, []);
2485
- const [h, p] = B(null);
2486
- U(() => {
2487
- let m = !1, d = !1;
2488
- const w = t.stripePublicKey ?? "", T = t.serverUrl ?? "", x = t.solanaCluster, M = t.solanaEndpoint, _ = t.dangerouslyAllowUnknownMint, F = r.complianceCheck;
2489
- return Ge(w, T, x, M, _, F).then((S) => {
2600
+ const [d, y] = q(null);
2601
+ B(() => {
2602
+ let m = !1, h = !1;
2603
+ const w = t.stripePublicKey ?? "", T = t.serverUrl ?? "", I = t.solanaCluster, x = t.solanaEndpoint, _ = t.dangerouslyAllowUnknownMint, N = r.complianceCheck;
2604
+ return Ge(w, T, I, x, _, N).then((S) => {
2490
2605
  if (m) {
2491
- ie(w, T, x, M, _, F);
2606
+ ie(w, T, I, x, _, N);
2492
2607
  return;
2493
2608
  }
2494
- d = !0, p(S);
2609
+ h = !0, y(S);
2495
2610
  }).catch((S) => {
2496
- m || (c().error("[CedrosProvider] Manager initialization failed:", S), n("Failed to initialize Cedros provider"));
2611
+ m || (l().error("[CedrosProvider] Manager initialization failed:", S), n("Failed to initialize Cedros provider"));
2497
2612
  }), () => {
2498
- m = !0, d && ie(w, T, x, M, _, F);
2613
+ m = !0, h && ie(w, T, I, x, _, N);
2499
2614
  };
2500
2615
  }, [
2501
2616
  t.stripePublicKey,
@@ -2505,51 +2620,52 @@ function ft({ config: i, children: e }) {
2505
2620
  t.dangerouslyAllowUnknownMint,
2506
2621
  r.complianceCheck
2507
2622
  ]);
2508
- const g = Q(() => h ? {
2623
+ const g = G(() => d ? {
2509
2624
  config: t,
2510
2625
  featureFlags: r,
2511
- ...h,
2626
+ ...d,
2512
2627
  walletPool: s,
2513
2628
  solanaError: u
2514
- } : null, [t, r, h, s, u]);
2515
- return a ? /* @__PURE__ */ V("div", { role: "alert", children: a }) : /* @__PURE__ */ V(
2516
- be,
2629
+ } : null, [t, r, d, s, u]);
2630
+ return a ? /* @__PURE__ */ J("div", { role: "alert", children: a }) : /* @__PURE__ */ J(
2631
+ ot,
2517
2632
  {
2518
2633
  initialMode: t.theme ?? "light",
2519
2634
  overrides: t.themeOverrides,
2520
2635
  unstyled: t.unstyled ?? !1,
2521
- children: g ? /* @__PURE__ */ V(me.Provider, { value: g, children: e }) : null
2636
+ children: g ? /* @__PURE__ */ J(we.Provider, { value: g, children: e }) : null
2522
2637
  }
2523
2638
  );
2524
2639
  }
2525
- function mt() {
2526
- const i = pe(me);
2640
+ function bt() {
2641
+ const i = oe(we);
2527
2642
  if (!i)
2528
2643
  throw new Error("useCedrosContext must be used within CedrosProvider");
2529
2644
  return i;
2530
2645
  }
2531
2646
  export {
2532
- lt as C,
2647
+ mt as C,
2533
2648
  De as E,
2534
- he as F,
2649
+ ye as F,
2535
2650
  A as P,
2536
- N as R,
2537
- ft as a,
2651
+ F as R,
2652
+ vt as a,
2538
2653
  v as b,
2539
- Ie as c,
2540
- q as d,
2654
+ Me as c,
2655
+ U as d,
2541
2656
  C as e,
2542
2657
  H as f,
2543
2658
  D as g,
2544
- ut as h,
2545
- dt as i,
2546
- ht as j,
2659
+ yt as h,
2660
+ pt as i,
2661
+ gt as j,
2547
2662
  P as k,
2548
- O as l,
2549
- Oe as m,
2550
- b as n,
2663
+ wt as l,
2664
+ O as m,
2665
+ Oe as n,
2666
+ b as o,
2551
2667
  Xe as p,
2552
- fe as r,
2553
- mt as u,
2668
+ pe as r,
2669
+ bt as u,
2554
2670
  tt as v
2555
2671
  };