@bwalletx/connect 0.5.4 → 0.7.0

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +97 -9
  3. package/dist/bwalletx-connect.global.js +97 -25
  4. package/dist/bwalletx-connect.global.js.map +1 -1
  5. package/dist/choice-B97AjqF4.d.cts +442 -0
  6. package/dist/choice-B97AjqF4.d.ts +442 -0
  7. package/dist/chunk-6EFFOIHK.js +2441 -0
  8. package/dist/chunk-6EFFOIHK.js.map +1 -0
  9. package/dist/{chunk-QRXFL66W.js → chunk-A2WLGS25.js} +6 -4
  10. package/dist/chunk-A2WLGS25.js.map +1 -0
  11. package/dist/chunk-DIKJFKND.js +239 -0
  12. package/dist/chunk-DIKJFKND.js.map +1 -0
  13. package/dist/chunk-TNRI7ARM.js +206 -0
  14. package/dist/chunk-TNRI7ARM.js.map +1 -0
  15. package/dist/element-BXEoOdXY.d.cts +53 -0
  16. package/dist/element-BXEoOdXY.d.ts +53 -0
  17. package/dist/element.cjs +1576 -60
  18. package/dist/element.cjs.map +1 -1
  19. package/dist/element.d.cts +26 -26
  20. package/dist/element.d.ts +26 -26
  21. package/dist/element.js +35 -2
  22. package/dist/element.js.map +1 -1
  23. package/dist/index.cjs +2046 -454
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +323 -16
  26. package/dist/index.d.ts +323 -16
  27. package/dist/index.js +186 -12
  28. package/dist/index.js.map +1 -1
  29. package/dist/next.cjs +5 -3
  30. package/dist/next.cjs.map +1 -1
  31. package/dist/next.js +1 -1
  32. package/dist/react.cjs +1601 -210
  33. package/dist/react.cjs.map +1 -1
  34. package/dist/react.d.cts +115 -9
  35. package/dist/react.d.ts +115 -9
  36. package/dist/react.js +262 -46
  37. package/dist/react.js.map +1 -1
  38. package/dist/server.cjs +5 -3
  39. package/dist/server.cjs.map +1 -1
  40. package/dist/server.d.cts +8 -3
  41. package/dist/server.d.ts +8 -3
  42. package/dist/server.js +1 -1
  43. package/package.json +10 -9
  44. package/dist/chunk-EXRQJTXF.js +0 -910
  45. package/dist/chunk-EXRQJTXF.js.map +0 -1
  46. package/dist/chunk-QRXFL66W.js.map +0 -1
  47. package/dist/chunk-RIOHG5JH.js +0 -459
  48. package/dist/chunk-RIOHG5JH.js.map +0 -1
  49. package/dist/wallets-CbzMtxrf.d.cts +0 -250
  50. package/dist/wallets-CbzMtxrf.d.ts +0 -250
@@ -1,29 +1,29 @@
1
- declare const SIGNIN_TAG = "bwalletx-signin";
2
- declare const GET_URL = "https://bwalletx.com/get";
3
- declare const WEB_WALLET_URL = "https://web.bwalletx.com";
4
- type SigninSize = 'lg' | 'md' | 'sm' | 'icon';
5
- type SigninTheme = 'gold' | 'dark' | 'light';
6
- type SigninLabel = 'signin' | 'continue' | 'connect';
7
- type SigninBrand = 'bWalletX' | 'bWallet';
8
- /** The visible label for a label/brand pair, e.g. "Sign in with bWalletX". */
9
- declare function signinText(label?: SigninLabel, brand?: SigninBrand): string;
10
- /** The gold "b" (bwalletx-site/logo.svg). Ids are unique per copy so several marks can share a page. */
11
- declare function markSvg(px?: number): string;
12
- declare const SIGNIN_CSS = "\n:host{display:inline-block;vertical-align:middle;font-family:Inter,ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",Roboto,sans-serif}\n:host([full-width]){display:block;width:100%}\n:host([hidden]){display:none}\nbutton{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:12px;width:100%;cursor:pointer;\n padding:16px 20px;border-radius:12px;font-size:16px;font-weight:700;line-height:1.2;text-align:left;\n background:linear-gradient(180deg,#fcd34d,#f59e0b);color:#000;\n box-shadow:0 10px 15px -3px rgba(245,158,11,.2),0 4px 6px -4px rgba(245,158,11,.2);\n transition:background .15s,transform .1s,box-shadow .15s,border-color .15s;-webkit-tap-highlight-color:transparent}\nbutton:hover{background:linear-gradient(180deg,#fde68a,#fbbf24)}\nbutton:active{transform:translateY(1px);background:linear-gradient(180deg,#fbbf24,#d97706)}\nbutton:focus-visible{outline:2px solid #b45309;outline-offset:3px}\nbutton:disabled{opacity:.6;cursor:not-allowed;transform:none}\nbutton[aria-busy=true]{cursor:wait}\n.mark{display:inline-flex;align-items:center;justify-content:center;flex:none;width:28px;height:28px;border-radius:50%;background:#000}\n.txt{display:flex;flex-direction:column;align-items:flex-start;min-width:0}\n.txt b{font-weight:700;white-space:nowrap}\n.txt small{font-size:11px;font-weight:500;color:rgba(0,0,0,.65);white-space:nowrap}\n.spin{width:16px;height:16px;border-radius:50%;border:2px solid rgba(255,210,77,.35);border-top-color:#ffd24d;animation:r .8s linear infinite}\n@keyframes r{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion:reduce){button{transition:none}button:active{transform:none}.spin{animation:none;border-color:#ffd24d;border-right-color:transparent}}\n/* sizes */\n:host([size=md]) button{padding:10px 16px;border-radius:10px;font-size:15px;gap:10px}\n:host([size=md]) .mark{width:24px;height:24px}\n:host([size=md]) .txt small{font-size:10.5px}\n:host([size=sm]) button{padding:6px 12px 6px 6px;border-radius:8px;font-size:13px;gap:8px;min-height:36px}\n:host([size=sm]) .mark{width:22px;height:22px}\n:host([size=icon]) button{width:48px;height:48px;padding:0;border-radius:50%;gap:0}\n:host([size=icon]) .mark{width:34px;height:34px}\n/* themes */\n:host([theme=dark]) button{background:#0a0a0a;color:#fafafa;border:1px solid #3f3f46;box-shadow:none}\n:host([theme=dark]) button:hover{background:#18181b;border-color:rgba(251,191,36,.6)}\n:host([theme=dark]) button:active{background:#000}\n:host([theme=dark]) button:focus-visible{outline-color:#fcd34d}\n:host([theme=dark]) .mark{box-shadow:inset 0 0 0 1px #3f3f46}\n:host([theme=dark]) .txt small{color:rgba(255,255,255,.65)}\n:host([theme=light]) button{background:#fff;color:#09090b;border:1px solid #d4d4d8;box-shadow:0 1px 2px rgba(0,0,0,.06)}\n:host([theme=light]) button:hover{background:#fafafa;border-color:#f59e0b}\n:host([theme=light]) button:active{background:#f4f4f5}\n:host([theme=light]) .txt small{color:#52525b}\n/* not found */\n.nf{margin-top:8px;font-size:12px;line-height:1.4;color:#71717a;text-align:center}\n.nf a{color:inherit;font-weight:600;text-decoration:underline;text-underline-offset:2px}\n.nf a:focus-visible{outline:2px solid #b45309;outline-offset:2px;border-radius:2px}\n:host([theme=dark]) .nf,:host-context(.dark) .nf{color:#a1a1aa}\n.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n";
13
- /** Optional OAuth parameters for authorize-url mode. auth.bwalletx.com is planned, not live. */
14
- interface AuthorizeParams {
15
- authorizeUrl: string;
16
- clientId?: string | null;
17
- redirectUri?: string | null;
18
- scope?: string | null;
19
- }
1
+ export { A as AuthorizeParams, C as CONTINUE_OTHER_LABEL, G as GET_URL, M as MENU_CSS, P as PENDING_LABEL, e as PENDING_LABEL_OTHER, f as PENDING_NOTE, g as SIGNIN_CSS, h as SIGNIN_TAG, i as SWITCH_NOTE, j as SigninAccount, c as SigninBrand, b as SigninLabel, k as SigninMode, S as SigninSize, d as SigninState, a as SigninTheme, W as WEB_WALLET_URL, l as buildAuthorizeUrl, m as defineBwalletxSignin, n as markSvg, s as signinText } from './element-BXEoOdXY.cjs';
2
+
3
+ declare const BUTTON_TAG = "bwalletx-button";
4
+ /** Legacy (0.5.5) localStorage key that held the identity key. Deleted on load since 0.5.6; never written. */
5
+ declare const CONNECTED_KEY = "bwx:connected";
20
6
  /**
21
- * Build an OAuth 2.1 authorization-code + S256 PKCE redirect URL, and keep the verifier, state and
22
- * nonce in sessionStorage under "bwalletx:oauth" for your callback page. Matches the plan in
23
- * bit-sign docs/SIGN-IN-WITH-BWALLETX.md. The provider is not live yet.
7
+ * (0.6.0) Migrate the 0.5.5 `bwx:connected` entry to the type-only record: the user had connected bWalletX here, so
8
+ * remember { type: 'bwalletx' } (unless a choice is already remembered) and delete the key. True when one was there.
24
9
  */
25
- declare function buildAuthorizeUrl(p: AuthorizeParams): Promise<string>;
26
- /** Register <bwalletx-signin> (once). Safe to call on a server: it does nothing there. */
27
- declare function defineBwalletxSignin(tag?: string): CustomElementConstructor | undefined;
10
+ declare function migrateConnectedKey(): boolean;
11
+ /** Delete the 0.5.5 `bwx:connected` entry (it held the identity key). True when one was there. */
12
+ declare function dropLegacyConnectedKey(): boolean;
13
+ type ButtonState = 'checking' | 'none' | 'available' | 'connecting' | 'connected';
14
+ /** Where "Get bWalletX" goes for this user agent. */
15
+ declare function getUrlFor(ua: string, touchMac?: boolean): string;
16
+ /** What a signed-out button should say before/after discovery. */
17
+ declare function stateFor(o: {
18
+ connected: boolean;
19
+ found: boolean | null;
20
+ phone: boolean;
21
+ }): ButtonState;
22
+ /** $alice for alice@bwalletx.com, other paymails in full, else a short key. */
23
+ declare function handleLabel(key: string, paymail: string | null): string;
24
+ /** Register <bwalletx-button> (idempotent; no-op on a server). */
25
+ declare function defineBwalletxButton(tag?: string): void;
26
+ /** Test hook: forget which button owns the page. */
27
+ declare function _resetBwalletxButtons(): void;
28
28
 
29
- export { type AuthorizeParams, GET_URL, SIGNIN_CSS, SIGNIN_TAG, type SigninBrand, type SigninLabel, type SigninSize, type SigninTheme, WEB_WALLET_URL, buildAuthorizeUrl, defineBwalletxSignin, markSvg, signinText };
29
+ export { BUTTON_TAG, type ButtonState, CONNECTED_KEY, _resetBwalletxButtons, defineBwalletxButton, dropLegacyConnectedKey, getUrlFor, handleLabel, migrateConnectedKey, stateFor };
package/dist/element.d.ts CHANGED
@@ -1,29 +1,29 @@
1
- declare const SIGNIN_TAG = "bwalletx-signin";
2
- declare const GET_URL = "https://bwalletx.com/get";
3
- declare const WEB_WALLET_URL = "https://web.bwalletx.com";
4
- type SigninSize = 'lg' | 'md' | 'sm' | 'icon';
5
- type SigninTheme = 'gold' | 'dark' | 'light';
6
- type SigninLabel = 'signin' | 'continue' | 'connect';
7
- type SigninBrand = 'bWalletX' | 'bWallet';
8
- /** The visible label for a label/brand pair, e.g. "Sign in with bWalletX". */
9
- declare function signinText(label?: SigninLabel, brand?: SigninBrand): string;
10
- /** The gold "b" (bwalletx-site/logo.svg). Ids are unique per copy so several marks can share a page. */
11
- declare function markSvg(px?: number): string;
12
- declare const SIGNIN_CSS = "\n:host{display:inline-block;vertical-align:middle;font-family:Inter,ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",Roboto,sans-serif}\n:host([full-width]){display:block;width:100%}\n:host([hidden]){display:none}\nbutton{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:12px;width:100%;cursor:pointer;\n padding:16px 20px;border-radius:12px;font-size:16px;font-weight:700;line-height:1.2;text-align:left;\n background:linear-gradient(180deg,#fcd34d,#f59e0b);color:#000;\n box-shadow:0 10px 15px -3px rgba(245,158,11,.2),0 4px 6px -4px rgba(245,158,11,.2);\n transition:background .15s,transform .1s,box-shadow .15s,border-color .15s;-webkit-tap-highlight-color:transparent}\nbutton:hover{background:linear-gradient(180deg,#fde68a,#fbbf24)}\nbutton:active{transform:translateY(1px);background:linear-gradient(180deg,#fbbf24,#d97706)}\nbutton:focus-visible{outline:2px solid #b45309;outline-offset:3px}\nbutton:disabled{opacity:.6;cursor:not-allowed;transform:none}\nbutton[aria-busy=true]{cursor:wait}\n.mark{display:inline-flex;align-items:center;justify-content:center;flex:none;width:28px;height:28px;border-radius:50%;background:#000}\n.txt{display:flex;flex-direction:column;align-items:flex-start;min-width:0}\n.txt b{font-weight:700;white-space:nowrap}\n.txt small{font-size:11px;font-weight:500;color:rgba(0,0,0,.65);white-space:nowrap}\n.spin{width:16px;height:16px;border-radius:50%;border:2px solid rgba(255,210,77,.35);border-top-color:#ffd24d;animation:r .8s linear infinite}\n@keyframes r{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion:reduce){button{transition:none}button:active{transform:none}.spin{animation:none;border-color:#ffd24d;border-right-color:transparent}}\n/* sizes */\n:host([size=md]) button{padding:10px 16px;border-radius:10px;font-size:15px;gap:10px}\n:host([size=md]) .mark{width:24px;height:24px}\n:host([size=md]) .txt small{font-size:10.5px}\n:host([size=sm]) button{padding:6px 12px 6px 6px;border-radius:8px;font-size:13px;gap:8px;min-height:36px}\n:host([size=sm]) .mark{width:22px;height:22px}\n:host([size=icon]) button{width:48px;height:48px;padding:0;border-radius:50%;gap:0}\n:host([size=icon]) .mark{width:34px;height:34px}\n/* themes */\n:host([theme=dark]) button{background:#0a0a0a;color:#fafafa;border:1px solid #3f3f46;box-shadow:none}\n:host([theme=dark]) button:hover{background:#18181b;border-color:rgba(251,191,36,.6)}\n:host([theme=dark]) button:active{background:#000}\n:host([theme=dark]) button:focus-visible{outline-color:#fcd34d}\n:host([theme=dark]) .mark{box-shadow:inset 0 0 0 1px #3f3f46}\n:host([theme=dark]) .txt small{color:rgba(255,255,255,.65)}\n:host([theme=light]) button{background:#fff;color:#09090b;border:1px solid #d4d4d8;box-shadow:0 1px 2px rgba(0,0,0,.06)}\n:host([theme=light]) button:hover{background:#fafafa;border-color:#f59e0b}\n:host([theme=light]) button:active{background:#f4f4f5}\n:host([theme=light]) .txt small{color:#52525b}\n/* not found */\n.nf{margin-top:8px;font-size:12px;line-height:1.4;color:#71717a;text-align:center}\n.nf a{color:inherit;font-weight:600;text-decoration:underline;text-underline-offset:2px}\n.nf a:focus-visible{outline:2px solid #b45309;outline-offset:2px;border-radius:2px}\n:host([theme=dark]) .nf,:host-context(.dark) .nf{color:#a1a1aa}\n.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n";
13
- /** Optional OAuth parameters for authorize-url mode. auth.bwalletx.com is planned, not live. */
14
- interface AuthorizeParams {
15
- authorizeUrl: string;
16
- clientId?: string | null;
17
- redirectUri?: string | null;
18
- scope?: string | null;
19
- }
1
+ export { A as AuthorizeParams, C as CONTINUE_OTHER_LABEL, G as GET_URL, M as MENU_CSS, P as PENDING_LABEL, e as PENDING_LABEL_OTHER, f as PENDING_NOTE, g as SIGNIN_CSS, h as SIGNIN_TAG, i as SWITCH_NOTE, j as SigninAccount, c as SigninBrand, b as SigninLabel, k as SigninMode, S as SigninSize, d as SigninState, a as SigninTheme, W as WEB_WALLET_URL, l as buildAuthorizeUrl, m as defineBwalletxSignin, n as markSvg, s as signinText } from './element-BXEoOdXY.js';
2
+
3
+ declare const BUTTON_TAG = "bwalletx-button";
4
+ /** Legacy (0.5.5) localStorage key that held the identity key. Deleted on load since 0.5.6; never written. */
5
+ declare const CONNECTED_KEY = "bwx:connected";
20
6
  /**
21
- * Build an OAuth 2.1 authorization-code + S256 PKCE redirect URL, and keep the verifier, state and
22
- * nonce in sessionStorage under "bwalletx:oauth" for your callback page. Matches the plan in
23
- * bit-sign docs/SIGN-IN-WITH-BWALLETX.md. The provider is not live yet.
7
+ * (0.6.0) Migrate the 0.5.5 `bwx:connected` entry to the type-only record: the user had connected bWalletX here, so
8
+ * remember { type: 'bwalletx' } (unless a choice is already remembered) and delete the key. True when one was there.
24
9
  */
25
- declare function buildAuthorizeUrl(p: AuthorizeParams): Promise<string>;
26
- /** Register <bwalletx-signin> (once). Safe to call on a server: it does nothing there. */
27
- declare function defineBwalletxSignin(tag?: string): CustomElementConstructor | undefined;
10
+ declare function migrateConnectedKey(): boolean;
11
+ /** Delete the 0.5.5 `bwx:connected` entry (it held the identity key). True when one was there. */
12
+ declare function dropLegacyConnectedKey(): boolean;
13
+ type ButtonState = 'checking' | 'none' | 'available' | 'connecting' | 'connected';
14
+ /** Where "Get bWalletX" goes for this user agent. */
15
+ declare function getUrlFor(ua: string, touchMac?: boolean): string;
16
+ /** What a signed-out button should say before/after discovery. */
17
+ declare function stateFor(o: {
18
+ connected: boolean;
19
+ found: boolean | null;
20
+ phone: boolean;
21
+ }): ButtonState;
22
+ /** $alice for alice@bwalletx.com, other paymails in full, else a short key. */
23
+ declare function handleLabel(key: string, paymail: string | null): string;
24
+ /** Register <bwalletx-button> (idempotent; no-op on a server). */
25
+ declare function defineBwalletxButton(tag?: string): void;
26
+ /** Test hook: forget which button owns the page. */
27
+ declare function _resetBwalletxButtons(): void;
28
28
 
29
- export { type AuthorizeParams, GET_URL, SIGNIN_CSS, SIGNIN_TAG, type SigninBrand, type SigninLabel, type SigninSize, type SigninTheme, WEB_WALLET_URL, buildAuthorizeUrl, defineBwalletxSignin, markSvg, signinText };
29
+ export { BUTTON_TAG, type ButtonState, CONNECTED_KEY, _resetBwalletxButtons, defineBwalletxButton, dropLegacyConnectedKey, getUrlFor, handleLabel, migrateConnectedKey, stateFor };
package/dist/element.js CHANGED
@@ -1,25 +1,58 @@
1
1
  import {
2
+ BUTTON_TAG,
3
+ CONNECTED_KEY,
4
+ _resetBwalletxButtons,
5
+ defineBwalletxButton,
6
+ dropLegacyConnectedKey,
7
+ getUrlFor,
8
+ handleLabel,
9
+ migrateConnectedKey,
10
+ stateFor
11
+ } from "./chunk-DIKJFKND.js";
12
+ import {
13
+ CONTINUE_OTHER_LABEL,
2
14
  GET_URL,
15
+ MENU_CSS,
16
+ PENDING_LABEL,
17
+ PENDING_LABEL_OTHER,
18
+ PENDING_NOTE,
3
19
  SIGNIN_CSS,
4
20
  SIGNIN_TAG,
21
+ SWITCH_NOTE,
5
22
  WEB_WALLET_URL,
6
23
  buildAuthorizeUrl,
7
24
  defineBwalletxSignin,
8
25
  markSvg,
9
26
  signinText
10
- } from "./chunk-EXRQJTXF.js";
27
+ } from "./chunk-6EFFOIHK.js";
11
28
  import "./chunk-MWD4BCO5.js";
12
29
 
13
30
  // src/define.ts
14
31
  defineBwalletxSignin();
32
+ defineBwalletxButton();
15
33
  export {
34
+ BUTTON_TAG,
35
+ CONNECTED_KEY,
36
+ CONTINUE_OTHER_LABEL,
16
37
  GET_URL,
38
+ MENU_CSS,
39
+ PENDING_LABEL,
40
+ PENDING_LABEL_OTHER,
41
+ PENDING_NOTE,
17
42
  SIGNIN_CSS,
18
43
  SIGNIN_TAG,
44
+ SWITCH_NOTE,
19
45
  WEB_WALLET_URL,
46
+ _resetBwalletxButtons,
20
47
  buildAuthorizeUrl,
48
+ defineBwalletxButton,
21
49
  defineBwalletxSignin,
50
+ dropLegacyConnectedKey,
51
+ getUrlFor,
52
+ handleLabel,
22
53
  markSvg,
23
- signinText
54
+ migrateConnectedKey,
55
+ signinText,
56
+ stateFor
24
57
  };
25
58
  //# sourceMappingURL=element.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/define.ts"],"sourcesContent":["// `import '@bwalletx/connect/element'` registers <bwalletx-signin> as a side effect.\nimport { defineBwalletxSignin } from './element.js';\n\nexport * from './element.js';\ndefineBwalletxSignin();\n"],"mappings":";;;;;;;;;;;;;AAIA,qBAAqB;","names":[]}
1
+ {"version":3,"sources":["../src/define.ts"],"sourcesContent":["// `import '@bwalletx/connect/element'` registers <bwalletx-signin> and <bwalletx-button> as a side effect.\nimport { defineBwalletxSignin } from './element.js';\nimport { defineBwalletxButton } from './wallet-button.js';\n\nexport * from './element.js';\nexport * from './wallet-button.js';\ndefineBwalletxSignin();\ndefineBwalletxButton();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,qBAAqB;AACrB,qBAAqB;","names":[]}