@lessly/sdk-app 32.1.0 → 32.1.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.
@@ -23,6 +23,10 @@ forwarded through a bearer proxy at exactly this path:
23
23
  proxies through `/lessly-api`, so your SDK client just talks to that path in
24
24
  dev — it never sees or handles the token itself.
25
25
 
26
+ So in dev you pass `baseUrl: '/lessly-api'` — a page-relative `baseUrl` is
27
+ supported and resolved against the current document (browser-only); see
28
+ `recipes/sdk-usage.md`.
29
+
26
30
  ### Device-code login
27
31
 
28
32
  The first time you run `pnpm dev` (or once your local session expires),
@@ -26,6 +26,26 @@ await sdk.organization.product.create({ name: 'Acme' });
26
26
  > [Namespaces and subpath imports](#namespaces-and-subpath-imports). The calls
27
27
  > above use `organization`; substitute the namespace/resource you need.
28
28
 
29
+ ### `baseUrl`: absolute or page-relative
30
+
31
+ `baseUrl` may be either form:
32
+
33
+ - **Absolute** — `'https://api.lessly.dev'`. Works anywhere, including SSR and
34
+ tests.
35
+ - **Page-relative** — `'/lessly-api'`, the path `pnpm dev` proxies through
36
+ (see `recipes/local-dev.md`). It is resolved against the current document via
37
+ `globalThis.location`, so it is **browser-only**: outside a browser the SDK
38
+ throws a named error (`@lessly/sdk-app: relative baseUrl "/lessly-api" cannot
39
+ be resolved outside a browser`) instead of an opaque `Invalid URL`. Tests and
40
+ SSR must pass an absolute base.
41
+
42
+ ```ts
43
+ const sdk = createLesslyApp({
44
+ baseUrl: import.meta.env.DEV ? '/lessly-api' : 'https://api.lessly.dev',
45
+ productId: 'prod_123',
46
+ });
47
+ ```
48
+
29
49
  `productId` is the active product — read it from your `./App` props or the
30
50
  `X-Product-Id` header (see APP-005), never decoded from a token.
31
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lessly/sdk-app",
3
- "version": "32.1.0",
3
+ "version": "32.1.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "engines": {