@ic-pay/icpay-widget 1.2.106 → 1.2.111
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/README.md +45 -17
- package/dist/{amount-input-CbtNz-UV.d.ts → amount-input-DlnLWkeX.d.ts} +12 -0
- package/dist/{chunk-2JG677BY.js → chunk-RCWWBMN4.js} +77 -77
- package/dist/chunk-RCWWBMN4.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/package.json +14 -3
- package/dist/chunk-2JG677BY.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# ICPay Widget
|
|
1
|
+
# ICPay Widget
|
|
2
2
|
|
|
3
|
-
Embeddable, framework-agnostic payment widgets powered by `@ic-pay/icpay-sdk`.
|
|
3
|
+
Embeddable, framework-agnostic payment widgets for **ICPay** — multi-chain crypto payments on **EVM (e.g. Base)**, **Solana**, and **Internet Computer**. Drop-in Web Components and React wrappers powered by `@ic-pay/icpay-sdk`.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -21,16 +21,26 @@ npm install @ic-pay/icpay-widget @ic-pay/icpay-sdk
|
|
|
21
21
|
|
|
22
22
|
## Components
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
| Component | Description |
|
|
25
|
+
|-----------|-------------|
|
|
26
|
+
| `icpay-pay-button` | One-click pay with fixed or configurable amount |
|
|
27
|
+
| `icpay-amount-input` | Enter custom USD amount, then pay |
|
|
28
|
+
| `icpay-tip-jar` | Preset tip amounts (e.g. $1, $5, $10) |
|
|
29
|
+
| `icpay-premium-content` | Gated content unlock (paywall) |
|
|
30
|
+
| `icpay-article-paywall` | Article paywall with preview and unlock |
|
|
31
|
+
| `icpay-coffee-shop` | Simple store with preset items and prices |
|
|
32
|
+
| `icpay-donation-thermometer` | Donation progress toward a goal |
|
|
33
|
+
| `icpay-progress-bar` | Transaction progress indicator (used internally) |
|
|
32
34
|
|
|
33
|
-
React bindings
|
|
35
|
+
React bindings for all components: `@ic-pay/icpay-widget/react`.
|
|
36
|
+
|
|
37
|
+
## Supported chains and wallets
|
|
38
|
+
|
|
39
|
+
- **EVM** (Base, etc.) — MetaMask, Coinbase Wallet, Brave, Rabby, OKX, WalletConnect (QR + deep links).
|
|
40
|
+
- **Solana** — Phantom, Backpack (and compatible `window.solana` providers).
|
|
41
|
+
- **Internet Computer** — Plug, Internet Identity (II), Oisy, NFID.
|
|
42
|
+
|
|
43
|
+
Use **token shortcodes** (e.g. `base_usdc`, `sol_usdc`, `ic_icp`) to choose chain and token. Filter options with `tokenShortcodes`, `chainShortcodes`, or `chainTypes` in config.
|
|
34
44
|
|
|
35
45
|
## Quick usage
|
|
36
46
|
|
|
@@ -43,7 +53,7 @@ HTML (with a bundler):
|
|
|
43
53
|
<icpay-pay-button
|
|
44
54
|
id="pay"
|
|
45
55
|
publishable-key="YOUR_PK"
|
|
46
|
-
token-shortcode="
|
|
56
|
+
token-shortcode="base_usdc"
|
|
47
57
|
amount-usd="5"
|
|
48
58
|
></icpay-pay-button>
|
|
49
59
|
```
|
|
@@ -54,16 +64,34 @@ import { IcpayPayButton } from '@ic-pay/icpay-widget/react';
|
|
|
54
64
|
|
|
55
65
|
export default function Example() {
|
|
56
66
|
return (
|
|
57
|
-
<IcpayPayButton
|
|
67
|
+
<IcpayPayButton
|
|
68
|
+
config={{
|
|
69
|
+
publishableKey: process.env.NEXT_PUBLIC_ICPAY_PK!,
|
|
70
|
+
tokenShortcode: 'base_usdc',
|
|
71
|
+
amountUsd: 5,
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
58
74
|
);
|
|
59
75
|
}
|
|
60
76
|
```
|
|
61
77
|
|
|
62
|
-
##
|
|
78
|
+
## Config highlights
|
|
79
|
+
|
|
80
|
+
- **publishableKey** (required) — From your ICPay account.
|
|
81
|
+
- **tokenShortcode** — Token/chain (e.g. `base_usdc`, `sol_usdc`, `ic_icp`). Omit to let the user pick.
|
|
82
|
+
- **tokenShortcodes** / **chainShortcodes** / **chainTypes** — Restrict which tokens or chains are shown.
|
|
83
|
+
- **recipientAddresses** — `{ evm?, ic?, sol? }` for relay payments to your addresses per chain.
|
|
84
|
+
- **theme** — `'light' | 'dark'` or a `ThemeConfig` object.
|
|
85
|
+
- **evmProvider** — Pass `window.ethereum` (or another provider) for EVM flows in the browser.
|
|
86
|
+
|
|
87
|
+
Full config and options: [docs.icpay.org](https://docs.icpay.org).
|
|
88
|
+
|
|
89
|
+
## Styling and theming
|
|
63
90
|
|
|
64
|
-
- Works out of the box.
|
|
65
|
-
-
|
|
91
|
+
- Works out of the box. Override with CSS variables on `:root` or the component (e.g. `--icpay-primary`, `--icpay-surface`, `--icpay-text`).
|
|
92
|
+
- Optional Tailwind build: `dist/tailwind.css`.
|
|
66
93
|
|
|
67
94
|
## Documentation
|
|
68
95
|
|
|
69
|
-
|
|
96
|
+
- **Component reference, theming, events, examples:** [https://docs.icpay.org](https://docs.icpay.org)
|
|
97
|
+
- **Sandbox (testnets):** [betterstripe.com](https://betterstripe.com) — test with Base Sepolia, Solana Devnet, and other test networks.
|
|
@@ -64,6 +64,12 @@ type CommonConfig = {
|
|
|
64
64
|
disableAfterSuccess?: boolean;
|
|
65
65
|
onrampDisabled?: boolean;
|
|
66
66
|
onramp?: OnrampConfig;
|
|
67
|
+
/**
|
|
68
|
+
* Optional: existing payment intent id (e.g. from server/checkout).
|
|
69
|
+
* When set, widget loads the intent from icpay-api; if already completed, shows success.
|
|
70
|
+
* Otherwise amount/currency and payment flow are driven by the loaded intent.
|
|
71
|
+
*/
|
|
72
|
+
paymentIntentId?: string;
|
|
67
73
|
};
|
|
68
74
|
type PremiumContentConfig = CommonConfig & {
|
|
69
75
|
priceUsd: number;
|
|
@@ -700,12 +706,15 @@ declare class ICPayPayButton extends LitElement {
|
|
|
700
706
|
private balancesLoading;
|
|
701
707
|
private balancesError;
|
|
702
708
|
private walletBalances;
|
|
709
|
+
private loadedPaymentIntent;
|
|
710
|
+
private paymentIntentLoading;
|
|
703
711
|
private onrampPollTimer;
|
|
704
712
|
private pnp;
|
|
705
713
|
private oisyConnectRetriedNewTab;
|
|
706
714
|
private sdk;
|
|
707
715
|
private onrampPollingActive;
|
|
708
716
|
private onrampNotifyController;
|
|
717
|
+
private onTransactionCompleted;
|
|
709
718
|
private getSdk;
|
|
710
719
|
/** Ensure WalletSelect (pnp) is created with same config as wallet modal; used by generateWalletConnectQr. */
|
|
711
720
|
private getOrCreatePnp;
|
|
@@ -730,6 +739,9 @@ declare class ICPayPayButton extends LitElement {
|
|
|
730
739
|
*/
|
|
731
740
|
connectWallet(walletId: string): Promise<void>;
|
|
732
741
|
connectedCallback(): void;
|
|
742
|
+
disconnectedCallback(): void;
|
|
743
|
+
/** Load payment intent by id from config; if completed show success, else merge intent into config for amount/currency and pass to SDK. */
|
|
744
|
+
private loadPaymentIntentIfNeeded;
|
|
733
745
|
protected updated(changed: Map<string, unknown>): void;
|
|
734
746
|
private onSwitchAccount;
|
|
735
747
|
private selectSymbol;
|