@usereq/widget 0.1.1 → 0.1.3

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
@@ -26,12 +26,12 @@ This repo publishes **one npm package**: `@usereq/widget` (scoped; see `package.
26
26
 
27
27
  These matter when you run **`bun run build`** (specifically the Vite embed step). Vite reads them from the repo root via `.env`, `.env.local`, `.env.production`, `.env.production.local`, and so on (see [Vite env files](https://vitejs.dev/guide/env-and-mode.html#env-files)). `vite build` uses mode **`production`**, so `.env.production` is the usual place for release API URLs.
28
28
 
29
- | Variable | When set | Effect |
30
- | --- | --- | --- |
31
- | `USEREQ_WIDGET_DEV_API_BASE` | Embed build | Highest-priority API origin (useful for dev-tag releases). If set, it overrides `USEREQ_WIDGET_API_BASE`. |
32
- | `USEREQ_WIDGET_API_BASE` | Embed build | Preferred API origin string inlined into `dist/widget.js` (no trailing slash normalization at build time; the runtime trims and strips trailing slashes). |
33
- | `NEXT_PUBLIC_API_URL` | Embed build | Used only if `USEREQ_WIDGET_API_BASE` is empty—handy if you already define this in a Next.js monorepo. |
34
- | *(neither set)* | Embed build | Falls back to `http://localhost:3000` in the Vite config. |
29
+ | Variable | When set | Effect |
30
+ | ---------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
31
+ | `USEREQ_WIDGET_DEV_API_BASE` | Embed build | Highest-priority API origin (useful for dev-tag releases). If set, it overrides `USEREQ_WIDGET_API_BASE`. |
32
+ | `USEREQ_WIDGET_API_BASE` | Embed build | Preferred API origin string inlined into `dist/widget.js` (no trailing slash normalization at build time; the runtime trims and strips trailing slashes). |
33
+ | `NEXT_PUBLIC_API_URL` | Embed build | Used only if `USEREQ_WIDGET_API_BASE` is empty—handy if you already define this in a Next.js monorepo. |
34
+ | _(neither set)_ | Embed build | Falls back to `http://localhost:3000` in the Vite config. |
35
35
 
36
36
  **Runtime `globalThis` (advanced):** `getWidgetApiBase()` (see `src/runtime/api-origin.ts`) prefers the compile-time `__USEREQ_WIDGET_API_BASE__` value when it is non-empty after trimming. The Vite embed build always defines that symbol to a non-empty string (see defaults above), so **changing the API URL for the published `dist/widget.js` requires a rebuild with a different `USEREQ_WIDGET_API_BASE`**. The `globalThis.__USEREQ_WIDGET_API_BASE__` path mainly applies when consuming source from this package without inlining a base URL (for example your own bundler without that `define`). If nothing resolves, the function falls back to `http://localhost:4000`.
37
37
 
@@ -154,7 +154,7 @@ npm view @usereq/widget version
154
154
  - **Publish** (`.github/workflows/publish.yml`): runs when you push tags matching:
155
155
  - `v*` (for example `v0.2.0`) → publishes to npm default `latest` tag.
156
156
  - `dev-v*` (for example `dev-v0.2.0-dev.1`) → publishes to npm `dev` dist-tag.
157
- Configure repository secrets:
157
+ Configure repository secrets:
158
158
  - **`NPM_TOKEN`** (required): npm automation token able to publish `@usereq/widget`.
159
159
  - **`USEREQ_WIDGET_API_BASE`** (optional): production API base for normal `v*` releases.
160
160
  - **`USEREQ_WIDGET_DEV_API_BASE`** (optional): dev API base used by `dev-v*` releases.