@markee_team/sdk 0.1.0-alpha.8 → 0.1.0-beta.1

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
@@ -4,6 +4,8 @@ An ESM JavaScript SDK with a self-contained, Shadow DOM modal and an optional Re
4
4
 
5
5
  Embed a Markee leaderboard in your app with wallet-funded For Sale and For Rent flows, automatic strategy detection, and a configurable theme. Eligible Base For Sale boards can also offer Markee-hosted card checkout when enabled by Markee. Incoming cross-chain funding is not included.
6
6
 
7
+ The package also includes a standalone **Markee sign button**. It shows the board's current winner, follows Markee's moderation decisions, and opens the payment modal when clicked.
8
+
7
9
  ## Installation
8
10
 
9
11
  ```sh
@@ -86,6 +88,21 @@ import { MarkeeModal } from '@markee_team/sdk/react';
86
88
 
87
89
  See [`examples/connectkit`](https://github.com/1Hive/markee/tree/feature/markee-sdk/examples/connectkit) for a complete adapter. Its connection promise resolves only once ConnectKit has selected a provider and rejects when the picker is dismissed. The SDK does not install a second wallet context.
88
90
 
91
+ ## Embed the current Markee sign
92
+
93
+ ```tsx
94
+ import { MarkeeSign } from '@markee_team/sdk/react';
95
+
96
+ const placement = { kind: 'board', chainId: 8453, address: '0x2768BC6e90266248BD8bCF5401C36D8049CdF671' } as const;
97
+ <MarkeeSign placement={placement} theme={{ mode: 'dark' }} />;
98
+ ```
99
+
100
+ `MarkeeSign` is a compact, clickable sign with the winner's message, view count, and a suggested monthly rate on For Rent boards. By default, clicking it opens the SDK modal. Pass `onOpen={() => setOpen(true)}` to open your own controlled `MarkeeModal` instead, or `showAction={false}` to render a non-clickable sign. The sign and modal accept separate `theme` values. No app-side moderation database, RPC key, or moderation provider is needed. To render from plain JavaScript, call `createMarkeeSign(containerElement, { placement })`; its return value has `refresh()`, `setTheme()`, and `destroy()`.
101
+
102
+ The sign fades in the real MARKEE logo behind the message on hover and keyboard focus, following the Gardens sign treatment. It selects the light or dark logo with the sign's theme, including system-mode changes. Set `theme={{ mode: 'dark', sign: { hoverLogo: false } }}` to disable the watermark. `sign.hoverBackground` remains available for an optional hover surface color; otherwise the sign keeps its normal surface. These options apply only to the sign, so the modal can use its own theme.
103
+
104
+ The SDK snapshot API reads **board moderation flags** from Markee's database. A flagged winner is blurred with a notice. The sign does not offer a reveal action or count a view for flagged content. If moderation data cannot be loaded, it withholds the message until the status is known. Visible, unflagged signs record one view per message. The sign refreshes every 30 seconds while mounted and can be refreshed on demand. Markee-only site flags intentionally apply only on markee.xyz; they do not censor a partner's embedded sign. Moderators still manage flags on Markee; moderation writes invalidate SDK snapshots so embedded signs can pick up changes on their next refresh.
105
+
89
106
  ## Modal layout
90
107
 
91
108
  Both strategies use a consistent, compact 512px panel with a fixed header/footer, a collapsible leaderboard, the selected message or editor, and a prominent amount card. The leaderboard pins your loaded messages and offers inline funding selection. Your active rental message is selected when available; otherwise an owned message or the creation form is shown.
@@ -104,7 +121,9 @@ import { createMarkee, type MarkeeTheme } from '@markee_team/sdk';
104
121
  const theme: MarkeeTheme = {
105
122
  mode: 'system',
106
123
  fontFamily: '"DM Sans", system-ui, sans-serif',
107
- radius: 12,
124
+ radius: 16,
125
+ cardRadius: 12,
126
+ controlRadius: 8,
108
127
  colors: {
109
128
  primary: '#743a84',
110
129
  primaryText: '#ffffff',
@@ -126,11 +145,17 @@ Theme changes update styles in place: drafts, focus, scroll, wallet sessions, an
126
145
  | --- | --- |
127
146
  | `mode` | `light`, `dark`, or `system` |
128
147
  | `fontFamily` | CSS font stack; the app supplies any custom font |
129
- | `radius` | Panel radius in pixels, 0–48 (default 22); card and control corners scale with it |
148
+ | `radius` | Panel radius in pixels, 0–48 (default 22) |
149
+ | `cardRadius` | Card radius in pixels, 0–48; defaults to 64% of panel radius |
150
+ | `controlRadius` | Button and input radius in pixels, 0–48; defaults to 45% of panel radius |
130
151
  | `colors` | Partial overrides for the semantic tokens below |
152
+ | `sign.hoverLogo` | Show the theme-matched MARKEE logo on hover/focus (default `true`) |
153
+ | `sign.hoverBackground` | Optional sign hover surface color; defaults to the normal surface |
131
154
 
132
155
  Color tokens: `background`, `surface`, `text`, `muted`, `border`, `inputBackground`, `inputText`, `primary`, `primaryText`, `accent`, `accentText`, `accentSurface`, `accentSurfaceText`, `accentBorder`, `selected`, `selectedText`, `info`, `infoText`, `error`, `errorText`, `success`, `successText`, `link`, `focusRing`, and `overlay`. Set foreground/background pairs together and check your brand's contrast in both modes. Overrides apply over either selected palette; omitted values use that palette's defaults. Invalid CSS color/font values fall back to defaults.
133
156
 
157
+ To match an app completely, override `link`, `focusRing`, `border`, `selected`/`selectedText`, and the accent colors as well as the primary button colors. Otherwise those elements retain the SDK palette. Use the typed theme options; arbitrary custom CSS is not currently supported. The sign’s price badge appears on hover or keyboard focus, and stays visible on touch devices.
158
+
134
159
  Styles are scoped to the modal's Shadow DOM and do not change the host app or its wallet picker. The ConnectKit sample includes light, dark, device, and custom Plum presets.
135
160
 
136
161
  ## Headless API
@@ -150,6 +175,14 @@ For Sale supports create/fund/edit. New message ownership belongs to the caller.
150
175
 
151
176
  For Rent supports message creation, starting/updating/switching/stopping a stream, wrap/unwrap, pool connection/refunds, board-buffer recovery, ranking refresh and settlement. The server builds the complete Superfluid batch, including exact ETHx approval and pool connection. Wallet runway uses the combined CFA and GDA net flow across the wallet, not only the current board. Rental MARKEE comes from actual settled rent, never merely from wrapping or depositing ETH.
152
177
 
178
+ Payment reviews remain visible while the wallet requests confirmation, including network switches. If a review expires when confirming, the modal shows **Refreshing payment details…**, prepares an updated review, and requires another confirmation click. It never automatically sends the refreshed transaction.
179
+
180
+ For Sale reviews are disabled when the entered payment exceeds the loaded ETH balance; the balance uses the error color and the button explains the shortfall. The API also checks network fees before wallet confirmation.
181
+
182
+ For Rent reviews show estimated **MARKEE/month while winning**, using the selected monthly stream rate and current on-chain reward settings. The estimate is not based on the ETH deposit and is not guaranteed; if quoting is unavailable, the modal shows a qualitative reward description. Rental transaction details contain only Network, Recipient, and Wallet; fees stay in the payment summary.
183
+
184
+ Refunds flow automatically when connected to the message’s refund pool. **Collect refund** appears only when the loaded wallet snapshot reports a positive claimable balance for that message’s pool. Board-buffer recovery is separate. Community revenue actions are accessed through **Community accumulated revenue**.
185
+
153
186
  Community activation supports the current council Safe, a current Safe owner, or the configured authorized keeper. Revenue claims support the current Safe or its current owners and always pay the council treasury. Existing outbound Across, Squid and LI.FI routing lives on Markee's server.
154
187
 
155
188
  ## Integration boundaries
@@ -164,7 +197,13 @@ Backend configuration and API reference: [`docs/sdk/implementation.md`](https://
164
197
 
165
198
  ## API endpoint
166
199
 
167
- No API URL or Markee API key is required. The SDK connects to the Markee-hosted API and centralizes on-chain reads, metadata, and transaction preparation. For local development or testing, pass an optional `apiUrl` override to `createMarkee`, `MarkeeClient`, or the React modal. The endpoint used by your installed release is exported as `DEFAULT_MARKEE_API_URL`.
200
+ No API URL or Markee API key is required. The SDK default is:
201
+
202
+ ```text
203
+ https://staging.markee.xyz/api/sdk/v1
204
+ ```
205
+
206
+ Markee hosts this API and centralizes on-chain reads, metadata, and transaction preparation. Staging does not imply test funds: Base placements use real funds. For local development or testing, pass an optional `apiUrl` override to `createMarkee`, `MarkeeClient`, or the React modal. The endpoint used by your installed release is exported as `DEFAULT_MARKEE_API_URL`.
168
207
 
169
208
  ## LLM implementation prompt
170
209
 
@@ -197,8 +236,9 @@ Ask only the remaining unanswered requirements in one concise group:
197
236
  Markee-hosted card checkout without an app wallet (For Sale on Base only)? Inspect
198
237
  existing connectors first; do not add a second wallet context or install a new
199
238
  connector without agreement.
200
- - Should the modal match the app theme or use specific colors, font, radius, and
201
- light/dark/system mode?
239
+ - Should the modal match the app theme or use specific colors, font, panel/card/
240
+ control radii, and light/dark/system mode? Include links, focus rings, borders,
241
+ and selected states when matching the host palette.
202
242
  - What public domain/page will host this integration? Use it as siteUrl for
203
243
  automatic verification. For Vite/client rendering, add the board marker to the
204
244
  static HTML as documented; do not claim localhost is verified.
@@ -221,7 +261,8 @@ Then implement the agreed scope:
221
261
  Otherwise omit wallet. Without a connected app account, the modal shows only
222
262
  Pay, opening Markee-hosted checkout for supported boards. Do not install
223
263
  Privy or collect card details in the host app.
224
- 5. Apply theme options while preserving the built-in modal layout. Handle onEvent
264
+ 5. Apply theme options (including radius, cardRadius, and controlRadius) while
265
+ preserving the built-in modal layout. Handle onEvent
225
266
  if needed; show success only for a confirmed event. Let the SDK manage review,
226
267
  network switching, submission, and verification.
227
268
  6. Verify build/types, loading of the supplied board, automatic strategy selection,
@@ -276,3 +317,28 @@ checkout route is deployed there. Both deployments must use the same checkout KV
276
317
  signing secret, supported configuration and Privy app. Omit this setting to keep
277
318
  checkout on the API origin. Integrators do not configure an API or checkout URL.
278
319
  Existing pending checkout sessions retain their original destination.
320
+
321
+ ### Pay in Markee availability
322
+
323
+ The SDK checks the Markee API before offering hosted payment. Markee controls this
324
+ feature with the server-only `FLAG_SDK_PAY_IN_MARKEE` environment variable, which
325
+ defaults to false. Only `true`, together with the required checkout configuration,
326
+ enables it. Integrating apps do not need to provide a flag or API key. Connected
327
+ wallet payments remain available independently.
328
+
329
+ ### Automatic message moderation
330
+
331
+ When enabled by Markee, create/edit forms warn if a message matches the automatic profanity
332
+ filter. Authors can edit or explicitly continue; publication may still be hidden. A passing
333
+ message edit clears an automatic flag, while manual flags require moderator action.
334
+
335
+ `await client.checkMessage(message)` exposes the same draft check for custom interfaces. It
336
+ returns `enabled`, `state`, `contentHash`, `engine`, `policyVersion`, and optional `reason`.
337
+ Treat `unavailable` as unknown, never as a pass. Names are not automatically checked.
338
+ The standard modal handles these warnings for React and vanilla JavaScript integrations.
339
+ No API key or moderation configuration is required in the host app.
340
+
341
+ Snapshots retain `entry.moderated` (`false`, `true`, or `null`) and can additionally include
342
+ `entry.moderation` with the state and reason. Hide unavailable and flagged content and do not
343
+ record views for it. A moderator's false-positive exception on Markee applies only on Markee;
344
+ it does not change SDK visibility. This optional backend feature is disabled by default.
package/dist/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { Action, Address, AdminOperation, AdminResult, Authorization, BridgeStatus, ClaimQuote, EIP1193Provider, Hex, Placement, PreparedAction, SDKOptions, Snapshot, SiteVerification, TransactionResult } from './types.js';
2
- /** Markee-hosted API for the alpha release. */
3
- export declare const DEFAULT_MARKEE_API_URL = "https://markee-git-feature-markee-sdk-1hive.vercel.app/api/sdk/v1";
1
+ import type { MessageCheck, Action, Address, AdminOperation, AdminResult, Authorization, BridgeStatus, ClaimQuote, EIP1193Provider, Hex, Placement, PreparedAction, SDKOptions, Snapshot, SiteVerification, TransactionResult } from './types.js';
2
+ /** Markee-hosted API used by integrations unless overridden for local development. */
3
+ export declare const DEFAULT_MARKEE_API_URL = "https://staging.markee.xyz/api/sdk/v1";
4
4
  export declare class MarkeeError extends Error {
5
5
  code: string;
6
6
  status?: number | undefined;
@@ -67,6 +67,7 @@ export declare class MarkeeClient {
67
67
  kind: 'gardens-community';
68
68
  }>): AdminResult | null;
69
69
  bridgeStatus(protocol: ClaimQuote['bridgeProtocol'], hash: Hex, fromChainId: number, toChainId: number): Promise<BridgeStatus>;
70
+ checkMessage(message: string): Promise<MessageCheck>;
70
71
  recordView(address: Address, message: string, url?: string): Promise<{
71
72
  counted: boolean;
72
73
  totalViews: number;
package/dist/index.d.ts CHANGED
@@ -5,3 +5,5 @@ export { createMarkee, MarkeeModal } from './modal.js';
5
5
  export type { ModalOptions } from './modal.js';
6
6
  export { parseEth, formatEth } from './amount.js';
7
7
  export { openHostedCheckout, checkoutStatus, savedCheckout } from './checkout.js';
8
+ export { createMarkeeSign, signContent } from './sign.js';
9
+ export type { MarkeeSignOptions } from './sign.js';