@moneymq/react 0.1.1 → 0.1.2

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.
package/dist/index.d.mts CHANGED
@@ -10,7 +10,7 @@ interface Branding {
10
10
 
11
11
  interface MoneyMQClient {
12
12
  config: {
13
- url: string;
13
+ endpoint: string;
14
14
  };
15
15
  }
16
16
  interface MoneyMQProviderProps {
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ interface Branding {
10
10
 
11
11
  interface MoneyMQClient {
12
12
  config: {
13
- url: string;
13
+ endpoint: string;
14
14
  };
15
15
  }
16
16
  interface MoneyMQProviderProps {
package/dist/index.js CHANGED
@@ -407,17 +407,17 @@ function MoneyMQProvider({
407
407
  const [sandboxAccounts, setSandboxAccounts] = (0, import_react3.useState)([]);
408
408
  (0, import_react3.useEffect)(() => {
409
409
  async function initialize() {
410
- const rpcUrl = await getRpcUrl(client.config.url);
410
+ const rpcUrl = await getRpcUrl(client.config.endpoint);
411
411
  setRpcEndpoint(rpcUrl);
412
412
  const isSandbox = await checkSandboxMode(rpcUrl);
413
413
  setIsSandboxMode(isSandbox);
414
414
  if (isSandbox) {
415
- const accounts = await fetchSandboxAccounts(client.config.url, rpcUrl);
415
+ const accounts = await fetchSandboxAccounts(client.config.endpoint, rpcUrl);
416
416
  setSandboxAccounts(accounts);
417
417
  }
418
418
  }
419
419
  initialize();
420
- }, [client.config.url]);
420
+ }, [client.config.endpoint]);
421
421
  const wallets = (0, import_react3.useMemo)(
422
422
  () => [
423
423
  new import_wallet_adapter_wallets.PhantomWalletAdapter(),
@@ -525,7 +525,7 @@ async function makeRequestWith402Handling(url, method, body, secretKeyHex, rpcUr
525
525
  async function createSandboxPayment(apiUrl, rpcUrl, amount, currency, recipient, senderAddress, secretKeyHex, productName) {
526
526
  console.log("[MoneyMQ] Creating sandbox payment...", { amount, currency, recipient, senderAddress });
527
527
  const paymentIntent = await makeRequestWith402Handling(
528
- `${apiUrl}/v1/payment_intents`,
528
+ `${apiUrl}/catalog/v1/payment_intents`,
529
529
  "POST",
530
530
  {
531
531
  amount: Math.round(amount * 100),
@@ -544,7 +544,7 @@ async function createSandboxPayment(apiUrl, rpcUrl, amount, currency, recipient,
544
544
  console.log("[MoneyMQ] Payment intent created:", paymentIntent);
545
545
  console.log("[MoneyMQ] Confirming payment intent:", paymentIntent.id);
546
546
  const confirmedIntent = await makeRequestWith402Handling(
547
- `${apiUrl}/v1/payment_intents/${paymentIntent.id}/confirm`,
547
+ `${apiUrl}/catalog/v1/payment_intents/${paymentIntent.id}/confirm`,
548
548
  "POST",
549
549
  {},
550
550
  secretKeyHex,
@@ -644,7 +644,7 @@ function PaymentModal({
644
644
  setIsSending(true);
645
645
  try {
646
646
  if (selectedPaymentMethod?.type === "sandbox_account" && secretKeyHex) {
647
- const apiUrl = normalizeRpcUrl2(client.config.url);
647
+ const apiUrl = normalizeRpcUrl2(client.config.endpoint);
648
648
  let rpcUrl = "http://localhost:8899";
649
649
  try {
650
650
  const configResponse = await fetch(`${apiUrl}/config`);
@@ -709,7 +709,7 @@ function PaymentModal({
709
709
  setIsSending(false);
710
710
  onError?.(err instanceof Error ? err : new Error(String(err)));
711
711
  }
712
- }, [publicKey, recipient, amount, currency, onSuccess, onError, onClose, selectedPaymentMethod, client.config.url, productName]);
712
+ }, [publicKey, recipient, amount, currency, onSuccess, onError, onClose, selectedPaymentMethod, client.config.endpoint, productName]);
713
713
  const canPay = (connected && publicKey || selectedPaymentMethod?.type === "sandbox_account") && recipient && !isSending;
714
714
  if (!visible) return null;
715
715
  const WalletIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
@@ -1391,7 +1391,7 @@ var PayButton = (0, import_react6.forwardRef)(
1391
1391
  setIsLoading(true);
1392
1392
  setError(null);
1393
1393
  try {
1394
- const apiUrl = client.config.url;
1394
+ const apiUrl = client.config.endpoint;
1395
1395
  const configResponse = await fetch(`${apiUrl}/config`);
1396
1396
  if (!configResponse.ok) {
1397
1397
  throw new Error(`Failed to fetch config: ${configResponse.status}`);
@@ -1407,7 +1407,7 @@ var PayButton = (0, import_react6.forwardRef)(
1407
1407
  setProductName(productObject.name);
1408
1408
  } else if (priceObject.product) {
1409
1409
  try {
1410
- const productResponse = await fetch(`${apiUrl}/v1/products/${priceObject.product}`);
1410
+ const productResponse = await fetch(`${apiUrl}/catalog/v1/products/${priceObject.product}`);
1411
1411
  if (productResponse.ok) {
1412
1412
  const product = await productResponse.json();
1413
1413
  setProductName(product.name);
@@ -1416,7 +1416,7 @@ var PayButton = (0, import_react6.forwardRef)(
1416
1416
  }
1417
1417
  }
1418
1418
  } else if (priceId) {
1419
- const priceResponse = await fetch(`${apiUrl}/v1/prices/${priceId}`);
1419
+ const priceResponse = await fetch(`${apiUrl}/catalog/v1/prices/${priceId}`);
1420
1420
  if (!priceResponse.ok) {
1421
1421
  throw new Error(`Failed to fetch price: ${priceResponse.status}`);
1422
1422
  }
@@ -1425,7 +1425,7 @@ var PayButton = (0, import_react6.forwardRef)(
1425
1425
  setCurrency(price.currency.toUpperCase());
1426
1426
  if (price.product) {
1427
1427
  try {
1428
- const productResponse = await fetch(`${apiUrl}/v1/products/${price.product}`);
1428
+ const productResponse = await fetch(`${apiUrl}/catalog/v1/products/${price.product}`);
1429
1429
  if (productResponse.ok) {
1430
1430
  const product = await productResponse.json();
1431
1431
  setProductName(product.name);
@@ -1446,7 +1446,7 @@ var PayButton = (0, import_react6.forwardRef)(
1446
1446
  }
1447
1447
  }
1448
1448
  fetchPaymentDetails();
1449
- }, [priceId, priceObject, productObject, client.config.url, onError, hasPriceObject]);
1449
+ }, [priceId, priceObject, productObject, client.config.endpoint, onError, hasPriceObject]);
1450
1450
  const handleClick = () => {
1451
1451
  if (!isLoading && !error) {
1452
1452
  setIsModalOpen(true);