@dj-test/payment-sdk 1.0.5 → 1.0.6

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.js CHANGED
@@ -618,7 +618,9 @@ var useOrder = (publicOrderId, options) => {
618
618
  const sdkError = handleAPIError(err);
619
619
  if (isInitial && retryCount < maxRetries && (sdkError.message.includes("incomplete") || sdkError.message.includes("null or invalid"))) {
620
620
  retryCount++;
621
- console.log(`[useOrder] Retrying order fetch (${retryCount}/${maxRetries})...`);
621
+ console.log(
622
+ `[useOrder] Retrying order fetch (${retryCount}/${maxRetries})...`
623
+ );
622
624
  setTimeout(() => fetchOrder(true), 500);
623
625
  return;
624
626
  }
@@ -632,7 +634,10 @@ var useOrder = (publicOrderId, options) => {
632
634
  fetchOrder(true);
633
635
  isInitialFetch.current = false;
634
636
  if (enablePolling) {
635
- intervalRef.current = setInterval(() => fetchOrder(false), pollingInterval);
637
+ intervalRef.current = setInterval(
638
+ () => fetchOrder(false),
639
+ pollingInterval
640
+ );
636
641
  }
637
642
  return () => {
638
643
  if (intervalRef.current) {
@@ -2510,7 +2515,10 @@ var OrderPayment = ({
2510
2515
  }
2511
2516
  }, [order, hasNotifiedSuccess, onSuccess, onError, publicOrderId]);
2512
2517
  const handleWalletPaymentSuccess = (result) => {
2513
- console.log("[OrderPayment] Wallet payment success, txHash:", result.txHash);
2518
+ console.log(
2519
+ "[OrderPayment] Wallet payment success, txHash:",
2520
+ result.txHash
2521
+ );
2514
2522
  };
2515
2523
  const handleRetry = () => {
2516
2524
  window.location.reload();
@@ -2557,13 +2565,30 @@ var OrderPayment = ({
2557
2565
  if (error) {
2558
2566
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `order-payment error ${className}`, children: [
2559
2567
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "error-container", children: [
2560
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "64", height: "64", viewBox: "0 0 24 24", fill: "none", stroke: "#ef4444", children: [
2561
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "12", cy: "12", r: "10", strokeWidth: "2" }),
2562
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 8v4M12 16h.01", strokeWidth: "2", strokeLinecap: "round" })
2563
- ] }),
2568
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2569
+ "svg",
2570
+ {
2571
+ width: "64",
2572
+ height: "64",
2573
+ viewBox: "0 0 24 24",
2574
+ fill: "none",
2575
+ stroke: "#ef4444",
2576
+ children: [
2577
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "12", cy: "12", r: "10", strokeWidth: "2" }),
2578
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 8v4M12 16h.01", strokeWidth: "2", strokeLinecap: "round" })
2579
+ ]
2580
+ }
2581
+ ),
2564
2582
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: "Payment Error" }),
2565
2583
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: error.message }),
2566
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { onClick: () => window.location.reload(), className: "retry-button", children: "Try Again" })
2584
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2585
+ "button",
2586
+ {
2587
+ onClick: () => window.location.reload(),
2588
+ className: "retry-button",
2589
+ children: "Try Again"
2590
+ }
2591
+ )
2567
2592
  ] }),
2568
2593
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: `
2569
2594
  .order-payment.error {
@@ -2615,7 +2640,10 @@ var OrderPayment = ({
2615
2640
  return null;
2616
2641
  }
2617
2642
  const orderState = getOrderState(order.orderStat);
2618
- const isExpired = new Date(order.expireDt) < /* @__PURE__ */ new Date();
2643
+ const expireDate = new Date(
2644
+ order.expireDt.endsWith("Z") ? order.expireDt : order.expireDt + "Z"
2645
+ );
2646
+ const isExpired = expireDate < /* @__PURE__ */ new Date();
2619
2647
  if (orderState !== "waiting" /* WAITING */ || isExpired) {
2620
2648
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2621
2649
  OrderStatusScreen,
package/dist/index.mjs CHANGED
@@ -548,7 +548,9 @@ var useOrder = (publicOrderId, options) => {
548
548
  const sdkError = handleAPIError(err);
549
549
  if (isInitial && retryCount < maxRetries && (sdkError.message.includes("incomplete") || sdkError.message.includes("null or invalid"))) {
550
550
  retryCount++;
551
- console.log(`[useOrder] Retrying order fetch (${retryCount}/${maxRetries})...`);
551
+ console.log(
552
+ `[useOrder] Retrying order fetch (${retryCount}/${maxRetries})...`
553
+ );
552
554
  setTimeout(() => fetchOrder(true), 500);
553
555
  return;
554
556
  }
@@ -562,7 +564,10 @@ var useOrder = (publicOrderId, options) => {
562
564
  fetchOrder(true);
563
565
  isInitialFetch.current = false;
564
566
  if (enablePolling) {
565
- intervalRef.current = setInterval(() => fetchOrder(false), pollingInterval);
567
+ intervalRef.current = setInterval(
568
+ () => fetchOrder(false),
569
+ pollingInterval
570
+ );
566
571
  }
567
572
  return () => {
568
573
  if (intervalRef.current) {
@@ -2451,7 +2456,10 @@ var OrderPayment = ({
2451
2456
  }
2452
2457
  }, [order, hasNotifiedSuccess, onSuccess, onError, publicOrderId]);
2453
2458
  const handleWalletPaymentSuccess = (result) => {
2454
- console.log("[OrderPayment] Wallet payment success, txHash:", result.txHash);
2459
+ console.log(
2460
+ "[OrderPayment] Wallet payment success, txHash:",
2461
+ result.txHash
2462
+ );
2455
2463
  };
2456
2464
  const handleRetry = () => {
2457
2465
  window.location.reload();
@@ -2498,13 +2506,30 @@ var OrderPayment = ({
2498
2506
  if (error) {
2499
2507
  return /* @__PURE__ */ jsxs5("div", { className: `order-payment error ${className}`, children: [
2500
2508
  /* @__PURE__ */ jsxs5("div", { className: "error-container", children: [
2501
- /* @__PURE__ */ jsxs5("svg", { width: "64", height: "64", viewBox: "0 0 24 24", fill: "none", stroke: "#ef4444", children: [
2502
- /* @__PURE__ */ jsx7("circle", { cx: "12", cy: "12", r: "10", strokeWidth: "2" }),
2503
- /* @__PURE__ */ jsx7("path", { d: "M12 8v4M12 16h.01", strokeWidth: "2", strokeLinecap: "round" })
2504
- ] }),
2509
+ /* @__PURE__ */ jsxs5(
2510
+ "svg",
2511
+ {
2512
+ width: "64",
2513
+ height: "64",
2514
+ viewBox: "0 0 24 24",
2515
+ fill: "none",
2516
+ stroke: "#ef4444",
2517
+ children: [
2518
+ /* @__PURE__ */ jsx7("circle", { cx: "12", cy: "12", r: "10", strokeWidth: "2" }),
2519
+ /* @__PURE__ */ jsx7("path", { d: "M12 8v4M12 16h.01", strokeWidth: "2", strokeLinecap: "round" })
2520
+ ]
2521
+ }
2522
+ ),
2505
2523
  /* @__PURE__ */ jsx7("h3", { children: "Payment Error" }),
2506
2524
  /* @__PURE__ */ jsx7("p", { children: error.message }),
2507
- /* @__PURE__ */ jsx7("button", { onClick: () => window.location.reload(), className: "retry-button", children: "Try Again" })
2525
+ /* @__PURE__ */ jsx7(
2526
+ "button",
2527
+ {
2528
+ onClick: () => window.location.reload(),
2529
+ className: "retry-button",
2530
+ children: "Try Again"
2531
+ }
2532
+ )
2508
2533
  ] }),
2509
2534
  /* @__PURE__ */ jsx7("style", { children: `
2510
2535
  .order-payment.error {
@@ -2556,7 +2581,10 @@ var OrderPayment = ({
2556
2581
  return null;
2557
2582
  }
2558
2583
  const orderState = getOrderState(order.orderStat);
2559
- const isExpired = new Date(order.expireDt) < /* @__PURE__ */ new Date();
2584
+ const expireDate = new Date(
2585
+ order.expireDt.endsWith("Z") ? order.expireDt : order.expireDt + "Z"
2586
+ );
2587
+ const isExpired = expireDate < /* @__PURE__ */ new Date();
2560
2588
  if (orderState !== "waiting" /* WAITING */ || isExpired) {
2561
2589
  return /* @__PURE__ */ jsx7("div", { className, children: /* @__PURE__ */ jsx7(
2562
2590
  OrderStatusScreen,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dj-test/payment-sdk",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Payment SDK for blockchain-based payment system",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",