suioutkit 1.0.2 → 1.0.4
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/assets/slush.jpeg +0 -0
- package/dist/components/modal.d.ts +6 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2138 -50
- package/dist/types/index.d.ts +11 -0
- package/package.json +11 -1
- package/src/components/modal.ts +56 -46
- package/src/components/style.css +264 -300
- package/src/index.ts +9 -10
- package/src/types/index.ts +13 -0
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) 2026 The3rdWebLabs (https://github.com/the3rdweblabs)
|
|
3
3
|
// Author: @CYBWithFlourish (https://github.com/CYBWithFlourish)
|
|
4
4
|
|
|
5
|
-
import { CheckoutSession, CheckoutSessionOptions, CryptoConfirmResponse } from "./types/index.js";
|
|
5
|
+
import { CheckoutSession, CheckoutSessionOptions, CryptoConfirmResponse, SuiOutKitModalOptions } from "./types/index.js";
|
|
6
6
|
import { SuiOutKitModal } from "./components/modal.js";
|
|
7
7
|
import { DEFAULT_API_ORIGIN, joinApiPath } from "./config/api.js";
|
|
8
8
|
|
|
@@ -51,10 +51,8 @@ export class SuiOutKit {
|
|
|
51
51
|
/**
|
|
52
52
|
* Spawns the interactive RainbowKit-style checkout modal.
|
|
53
53
|
*/
|
|
54
|
-
public openModal(session: CheckoutSession,
|
|
55
|
-
return new SuiOutKitModal(session, this.backendUrl,
|
|
56
|
-
if (onClose) onClose();
|
|
57
|
-
});
|
|
54
|
+
public openModal(session: CheckoutSession, options?: SuiOutKitModalOptions): SuiOutKitModal {
|
|
55
|
+
return new SuiOutKitModal(session, this.backendUrl, options);
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
/**
|
|
@@ -116,11 +114,12 @@ export class SuiOutKit {
|
|
|
116
114
|
|
|
117
115
|
try {
|
|
118
116
|
const session = await this.initCheckout(options);
|
|
119
|
-
this.openModal(session,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
this.openModal(session, {
|
|
118
|
+
onClose: () => {
|
|
119
|
+
btn.disabled = false;
|
|
120
|
+
btn.textContent = `Pay ${formattedAmount}`;
|
|
121
|
+
btn.style.opacity = "1";
|
|
122
|
+
},
|
|
124
123
|
});
|
|
125
124
|
} catch (err) {
|
|
126
125
|
alert("SuiOutKit Error: Unable to open secure payment session.");
|
package/src/types/index.ts
CHANGED
|
@@ -66,4 +66,17 @@ export interface CheckoutStatusResponse {
|
|
|
66
66
|
txDigest?: string;
|
|
67
67
|
walrusBlobId?: string;
|
|
68
68
|
error?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface PaymentResult {
|
|
72
|
+
nonce: string;
|
|
73
|
+
txDigest: string;
|
|
74
|
+
walrusBlobId: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface SuiOutKitModalOptions {
|
|
78
|
+
onClose?: () => void;
|
|
79
|
+
onPaymentComplete?: (result: PaymentResult) => void;
|
|
80
|
+
redirectUrl?: string;
|
|
81
|
+
autoCloseOnSuccess?: boolean;
|
|
69
82
|
}
|