@eos3/connect 0.1.12 → 0.1.13

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 CHANGED
@@ -56,6 +56,7 @@ await eosConnect.bootstrapTelegram();
56
56
  const quickPay = await eosConnect.checkQuickPay();
57
57
 
58
58
  if (!quickPay.enabled) {
59
+ // Requires <eos-connect-modal hidden></eos-connect-modal> from @eos3/connect-ui.
59
60
  await eosConnect.enableQuickPay();
60
61
  }
61
62
  ```
@@ -95,10 +96,10 @@ const eosConnect = createEosConnect({
95
96
 
96
97
  ## Quick Payment Flow
97
98
 
98
- For app UIs, prefer `checkQuickPay()` and `enableQuickPay()`. They hide
99
- low-level wallet capability statuses such as `needs_local_key`, open pending
100
- bind URLs, rebind the current device when the local payment key is missing, and
101
- can poll until quick payment is enabled:
99
+ For app UIs, use `checkQuickPay()` for readiness and `enableQuickPay()` for the
100
+ button click. `enableQuickPay()` does not start binding directly; it opens the
101
+ SDK-owned `<eos-connect-modal>` from `@eos3/connect-ui` so users always see the
102
+ quick payment setup sheet first:
102
103
 
103
104
  ```ts
104
105
  const quickPay = await eosConnect.checkQuickPay();
@@ -111,14 +112,12 @@ renderQuickPay({
111
112
  });
112
113
 
113
114
  if (!quickPay.enabled) {
114
- const next = await eosConnect.enableQuickPay({
115
- pollIntervalMs: 1500
116
- });
115
+ const next = await eosConnect.enableQuickPay();
117
116
  renderQuickPay(next);
118
117
  }
119
118
  ```
120
119
 
121
- `enableQuickPay()` performs the common Telegram setup sequence:
120
+ The modal's primary action performs the common Telegram setup sequence:
122
121
 
123
122
  - loads Telegram's WebApp SDK when needed;
124
123
  - initializes `BiometricManager` and checks SecureStorage support;
@@ -131,9 +130,9 @@ if (!quickPay.enabled) {
131
130
  the Telegram Mini App returns to the foreground.
132
131
 
133
132
  Advanced UIs can still call `getWalletView()` or `startTelegramWalletFlow()`
134
- when they need debug-level states and labels. Wallet setup always polls after
135
- opening the binding page and returns when the wallet is ready or reaches another
136
- terminal state.
133
+ inside SDK-owned UI when they need debug-level states and labels. Wallet setup
134
+ always polls after opening the binding page and returns when the wallet is ready
135
+ or reaches another terminal state.
137
136
 
138
137
  ## Connect a Telegram Wallet
139
138
 
@@ -285,8 +284,8 @@ await fetch('https://wallet.example.com/api/market/push', {
285
284
  - `checkEosConnectTelegramPayStorage(app)`: initializes Telegram biometrics and returns secure storage diagnostics.
286
285
  - `client.connectTelegram(options)`: starts or resumes Telegram binding.
287
286
  - `client.connectTokenPocket(options)`: starts TokenPocket binding.
288
- - `client.startTelegramWalletFlow(options)`: runs the high-level Telegram wallet setup flow.
289
- - `client.enableQuickPay(options)`: runs the high-level setup flow and returns quick payment readiness.
287
+ - `client.startTelegramWalletFlow(options)`: runs the high-level Telegram wallet setup flow from SDK-owned UI.
288
+ - `client.enableQuickPay()`: opens the SDK-owned `<eos-connect-modal>` and returns current quick payment readiness.
290
289
  - `client.pay(options)`: builds, signs, confirms, and pushes a paylimit payment.
291
290
  - `client.disconnect()`: removes the local Telegram payment key from
292
291
  SecureStorage, clears the biometric token, and resets the SDK state.
package/dist/index.d.ts CHANGED
@@ -139,7 +139,7 @@ export interface EosConnectClient {
139
139
  connectTelegram(options?: EosConnectTelegramOptions): Promise<EosConnectState>;
140
140
  connectTokenPocket(options?: EosConnectTelegramOptions): Promise<EosConnectState>;
141
141
  startTelegramWalletFlow(options?: EosConnectWalletFlowOptions): Promise<EosConnectWalletView>;
142
- enableQuickPay(options?: EosConnectWalletFlowOptions): Promise<EosConnectQuickPayStatus>;
142
+ enableQuickPay(): Promise<EosConnectQuickPayStatus>;
143
143
  pay(options: EosConnectPayOptions): Promise<EosConnectPayResult>;
144
144
  disconnect(): Promise<EosConnectState>;
145
145
  }
package/dist/index.js CHANGED
@@ -1320,6 +1320,14 @@ function waitForNextWalletPoll(ms) {
1320
1320
  documentRef.addEventListener('visibilitychange', onVisibilityChange);
1321
1321
  });
1322
1322
  }
1323
+ function openEosConnectUiModal() {
1324
+ const modal = globalThis.document?.querySelector?.('eos-connect-modal,eos-connect');
1325
+ if (!modal) {
1326
+ return false;
1327
+ }
1328
+ modal.removeAttribute('hidden');
1329
+ return true;
1330
+ }
1323
1331
  function openFlowUrl(url, clientOptions, flowOptions, telegramWebApp) {
1324
1332
  if (flowOptions.openExternal) {
1325
1333
  flowOptions.openExternal(url);
@@ -1634,8 +1642,11 @@ export function createEosConnect(options) {
1634
1642
  return walletViewFromError(normalized, message);
1635
1643
  }
1636
1644
  },
1637
- async enableQuickPay(flowOptions = {}) {
1638
- return quickPayFromView(await this.startTelegramWalletFlow(flowOptions));
1645
+ async enableQuickPay() {
1646
+ if (!openEosConnectUiModal()) {
1647
+ throw new Error('EOS Connect UI modal is required to enable quick payment');
1648
+ }
1649
+ return this.checkQuickPay();
1639
1650
  },
1640
1651
  async connectTokenPocket(tokenPocketOptions = {}) {
1641
1652
  const paymentKey = await generateEosConnectPaymentKey();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eos3/connect",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Framework-neutral browser SDK for EOS Passkey Connect in Telegram Mini Apps.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",