@bwalletx/connect 0.1.0 → 0.3.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 (51) hide show
  1. package/BRAND.md +84 -0
  2. package/README.md +83 -0
  3. package/TRADEMARKS.md +9 -0
  4. package/assets/bwalletx-mark-circle.svg +1 -0
  5. package/assets/bwalletx-mark.svg +1 -0
  6. package/assets/signin-dark.svg +8 -0
  7. package/assets/signin-gold.svg +8 -0
  8. package/assets/signin-light.svg +8 -0
  9. package/assets/snippet.html +17 -0
  10. package/dist/bwalletx-connect.global.js +48 -2
  11. package/dist/bwalletx-connect.global.js.map +1 -1
  12. package/dist/bwalletx-shell.global.js +54 -0
  13. package/dist/bwalletx-shell.global.js.map +1 -0
  14. package/dist/chunk-NNMUSWPG.js +649 -0
  15. package/dist/chunk-NNMUSWPG.js.map +1 -0
  16. package/dist/chunk-OMEKHKMM.js +530 -0
  17. package/dist/chunk-OMEKHKMM.js.map +1 -0
  18. package/dist/element.cjs +665 -0
  19. package/dist/element.cjs.map +1 -0
  20. package/dist/element.d.cts +29 -0
  21. package/dist/element.d.ts +29 -0
  22. package/dist/element.js +24 -0
  23. package/dist/element.js.map +1 -0
  24. package/dist/index.cjs +218 -2
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +1 -0
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.js +31 -426
  29. package/dist/index.js.map +1 -1
  30. package/dist/manifest-Caj_Raqm.d.cts +81 -0
  31. package/dist/manifest-Caj_Raqm.d.ts +81 -0
  32. package/dist/react.cjs +700 -0
  33. package/dist/react.cjs.map +1 -0
  34. package/dist/react.d.cts +70 -0
  35. package/dist/react.d.ts +70 -0
  36. package/dist/react.js +59 -0
  37. package/dist/react.js.map +1 -0
  38. package/dist/shell-react.cjs +361 -0
  39. package/dist/shell-react.cjs.map +1 -0
  40. package/dist/shell-react.d.cts +58 -0
  41. package/dist/shell-react.d.ts +58 -0
  42. package/dist/shell-react.js +52 -0
  43. package/dist/shell-react.js.map +1 -0
  44. package/dist/shell.cjs +578 -0
  45. package/dist/shell.cjs.map +1 -0
  46. package/dist/shell.d.cts +132 -0
  47. package/dist/shell.d.ts +132 -0
  48. package/dist/shell.js +51 -0
  49. package/dist/shell.js.map +1 -0
  50. package/package.json +79 -6
  51. package/schema/bapp.schema.json +95 -0
@@ -0,0 +1,81 @@
1
+ /**
2
+ * bApp manifest: /.well-known/bapp.json. One file declares the app's five scoped slots, its drawer
3
+ * (Home + sections) and its like-to-fund config. The web bar draws from it; inside bWalletX the
4
+ * wallet's native dock reads the same file. Every path is same-origin: no URLs, no schemes.
5
+ */
6
+ declare const SLOT_IDS: readonly ["wallet", "exchange", "b", "feed", "chat"];
7
+ type SlotId = (typeof SLOT_IDS)[number];
8
+ interface BappSlot {
9
+ /** Same-origin path, e.g. "/feed". Required when enabled, except for "b" (the agent). */
10
+ path?: string;
11
+ /** Optional rename ("Market"); the icon and position never change. */
12
+ label?: string;
13
+ /** false = shown greyed out and not clickable. Slots are never hidden. */
14
+ enabled: boolean;
15
+ }
16
+ interface BappDrawerItem {
17
+ label: string;
18
+ path: string;
19
+ /** Optional same-origin icon path. */
20
+ icon?: string;
21
+ }
22
+ interface BappLikeConfig {
23
+ /** Which fields of a feed item hold the id, token (BSV-21 id / $TICKER), payee, title and media. */
24
+ fields: {
25
+ id: string;
26
+ token: string;
27
+ payee?: string;
28
+ title?: string;
29
+ media?: string;
30
+ };
31
+ /** Price of one Like in US cents. Default 1 (one PNEE). */
32
+ amountCents: number;
33
+ /** Pay in PNEE (the wallet's USD-cent token) when held, else BSV. Default "PNEE". */
34
+ currency: 'PNEE' | 'BSV';
35
+ /** Daily cap in US cents. Default 100 ($1), never more. */
36
+ dailyCapCents: number;
37
+ }
38
+ interface BappTheme {
39
+ /** Active/accent colour, #RRGGBB. Default #FFD24D. */
40
+ accent?: string;
41
+ }
42
+ interface BappManifest {
43
+ version: 1;
44
+ name: string;
45
+ /** Same-origin path to a square icon. */
46
+ icon: string;
47
+ /** The app's Home (first drawer item). Default "/". */
48
+ home: string;
49
+ theme?: BappTheme;
50
+ slots: Record<SlotId, BappSlot>;
51
+ drawer: BappDrawerItem[];
52
+ like?: BappLikeConfig;
53
+ }
54
+ type ValidationResult = {
55
+ ok: true;
56
+ manifest: BappManifest;
57
+ errors: [];
58
+ } | {
59
+ ok: false;
60
+ errors: string[];
61
+ manifest?: undefined;
62
+ };
63
+ declare const WELL_KNOWN_PATH = "/.well-known/bapp.json";
64
+ declare const LIKE_DEFAULT_CENTS = 1;
65
+ declare const LIKE_MAX_DAILY_CENTS = 100;
66
+ /**
67
+ * A same-origin path: starts with one "/", no "//" (protocol-relative), no backslashes, no control
68
+ * characters, no scheme. Query and hash are allowed.
69
+ */
70
+ declare function isSameOriginPath(p: unknown): p is string;
71
+ /** Validate and normalise a parsed bapp.json. Never throws. */
72
+ declare function validateManifest(input: unknown): ValidationResult;
73
+ /** Same as validateManifest but throws with every error listed. */
74
+ declare function parseManifest(input: unknown): BappManifest;
75
+ /** Fetch and validate /.well-known/bapp.json (same origin). */
76
+ declare function loadManifest(path?: string, fetchImpl?: typeof fetch): Promise<BappManifest>;
77
+ /** The path a slot points at, or null when disabled / no path. */
78
+ declare function slotPath(m: BappManifest, slot: SlotId): string | null;
79
+ declare const isSlotId: (v: unknown) => v is SlotId;
80
+
81
+ export { type BappManifest as B, LIKE_DEFAULT_CENTS as L, type SlotId as S, type ValidationResult as V, WELL_KNOWN_PATH as W, type BappDrawerItem as a, type BappLikeConfig as b, type BappSlot as c, type BappTheme as d, LIKE_MAX_DAILY_CENTS as e, SLOT_IDS as f, isSlotId as g, isSameOriginPath as i, loadManifest as l, parseManifest as p, slotPath as s, validateManifest as v };