@dexterai/x402 1.9.2 → 1.9.3

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.
@@ -44,6 +44,7 @@ __export(server_exports, {
44
44
  createDynamicPricing: () => createDynamicPricing,
45
45
  createTokenPricing: () => createTokenPricing,
46
46
  createX402Server: () => createX402Server,
47
+ escapeHtml: () => escapeHtml,
47
48
  estimateCost: () => estimateCost,
48
49
  findModel: () => findModel,
49
50
  formatModelPricing: () => formatModelPricing,
@@ -710,7 +711,7 @@ function x402Middleware(config) {
710
711
  }
711
712
 
712
713
  // src/server/browser-support.ts
713
- function esc(s) {
714
+ function escapeHtml(s) {
714
715
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
715
716
  }
716
717
  var USDC_ICON_SVG = `<svg width="18" height="18" viewBox="0 0 2000 2000" xmlns="http://www.w3.org/2000/svg"><path d="M1000 2000c554.17 0 1000-445.83 1000-1000S1554.17 0 1000 0 0 445.83 0 1000s445.83 1000 1000 1000z" fill="#2775ca"/><path d="M1275 1158.33c0-145.83-87.5-195.83-262.5-216.66-125-16.67-150-50-150-108.34s41.67-95.83 125-95.83c75 0 116.67 25 137.5 87.5 4.17 12.5 16.67 20.83 29.17 20.83h66.66c16.67 0 29.17-12.5 29.17-29.16v-4.17c-16.67-91.67-91.67-162.5-187.5-170.83v-100c0-16.67-12.5-29.17-33.33-33.34h-62.5c-16.67 0-29.17 12.5-33.34 33.34v95.83c-125 16.67-204.16 100-204.16 204.17 0 137.5 83.33 191.66 258.33 212.5 116.67 20.83 154.17 45.83 154.17 112.5s-58.34 112.5-137.5 112.5c-108.34 0-145.84-45.84-158.34-108.34-4.16-16.66-16.66-25-29.16-25h-70.84c-16.66 0-29.16 12.5-29.16 29.17v4.17c16.66 104.16 83.33 179.16 220.83 200v100c0 16.66 12.5 29.16 33.33 33.33h62.5c16.67 0 29.17-12.5 33.34-33.33v-100c125-20.84 208.33-108.34 208.33-220.84z" fill="#fff"/><path d="M787.5 1595.83c-325-116.66-491.67-479.16-370.83-800 62.5-175 200-308.33 370.83-370.83 16.67-8.33 25-20.83 25-41.67V325c0-16.67-8.33-29.17-25-33.33-4.17 0-12.5 0-16.67 4.16-395.83 125-612.5 545.84-487.5 941.67 75 233.33 254.17 412.5 487.5 487.5 16.67 8.33 33.34 0 37.5-16.67 4.17-4.16 4.17-8.33 4.17-16.66v-58.34c0-12.5-12.5-29.16-25-37.5zM1229.17 295.83c-16.67-8.33-33.34 0-37.5 16.67-4.17 4.17-4.17 8.33-4.17 16.67v58.33c0 16.67 12.5 33.33 25 41.67 325 116.66 491.67 479.16 370.83 800-62.5 175-200 308.33-370.83 370.83-16.67 8.33-25 20.83-25 41.67V1700c0 16.67 8.33 29.17 25 33.33 4.17 0 12.5 0 16.67-4.16 395.83-125 612.5-545.84 487.5-941.67-75-237.5-258.34-416.67-487.5-491.67z" fill="#fff"/></svg>`;
@@ -972,22 +973,22 @@ function generatePaywallHtml(paymentRequiredHeader, requestUrl, method, config,
972
973
  } catch {
973
974
  }
974
975
  const chainName = network.includes("solana") ? "Solana" : network.includes("eip155") ? "Base" : "";
975
- const endpointSection = config.showEndpoint ? `<div class="endpoint"><code>${esc(method)} ${esc(requestUrl)}</code></div>` : "";
976
+ const endpointSection = config.showEndpoint ? `<div class="endpoint"><code>${escapeHtml(method)} ${escapeHtml(requestUrl)}</code></div>` : "";
976
977
  return `<!DOCTYPE html>
977
978
  <html lang="en">
978
979
  <head>
979
980
  <meta charset="utf-8">
980
981
  <meta name="viewport" content="width=device-width,initial-scale=1">
981
- <title>${esc(config.title)} \u2014 ${esc(price)} USDC</title>
982
+ <title>${escapeHtml(config.title)} \u2014 ${escapeHtml(price)} USDC</title>
982
983
  <style>${DEXTER_STYLES}${PAY_BUTTON_STYLES}</style>
983
984
  </head>
984
985
  <body>
985
986
  <div class="card">
986
987
  <div class="crest">${DEXTER_CREST_SVG}</div>
987
- <h1>${esc(config.title)}</h1>
988
- <p class="desc">${esc(description)}</p>
989
- <div class="price">${USDC_ICON_SVG}<span id="price-value">${esc(price)}</span></div>
990
- <div class="chain">${esc(chainName)}${chainName ? " network" : ""}</div>
988
+ <h1>${escapeHtml(config.title)}</h1>
989
+ <p class="desc">${escapeHtml(description)}</p>
990
+ <div class="price">${USDC_ICON_SVG}<span id="price-value">${escapeHtml(price)}</span></div>
991
+ <div class="chain">${escapeHtml(chainName)}${chainName ? " network" : ""}</div>
991
992
  ${endpointSection}
992
993
 
993
994
  <div id="pay-section" class="pay-section" style="display:none">
@@ -2116,6 +2117,7 @@ var import_x402_ads_types = require("@dexterai/x402-ads-types");
2116
2117
  createDynamicPricing,
2117
2118
  createTokenPricing,
2118
2119
  createX402Server,
2120
+ escapeHtml,
2119
2121
  estimateCost,
2120
2122
  findModel,
2121
2123
  formatModelPricing,